Using Unicode symbols in posts

Posted by John Espirian 
Using Unicode symbols in posts
March 16, 2013 04:18AM
Does anyone know why some symbols that are part of the Unicode set can't be rendered after a post has been submitted?

Here's an example. One of my users was making a post about a mathematical formula and in it he used the 'mathematical italic small a' symbol. He pasted in the character, which looked fine in preview but then disappeared from the post when it was published.

I'll do the same now and I'm guessing the symbol will also disappear in my published post even though I can see it in the preview:

Symbol goes here >>>
Re: Using Unicode symbols in posts
March 16, 2013 04:23PM
Is that character saved into the database?
Is your database connection set to utf-8 and the language too?


Thomas Seifert
Re: Using Unicode symbols in posts
March 27, 2013 07:20AM
Quote
Thomas Seifert
Is that character saved into the database?
Is your database connection set to utf-8 and the language too?

The character doesn't seem to be saved. In fact the more pressing issue is that the remainder of the post after the troublesome character is also lost. I wrote more in my OP above than what is shown, but it was lost after submission, even though the entire post rendered correctly in the preview. This is also what happens in my forum.

I'm using phpMyAdmin with a utf8 connection.The database's tables are mostly set to utf8_unicode_ci but a few of them are set to latin1_swedish_ci (I haven't changed these, which were the default setup). Will setting all tables to utf8_unicode_ci help?
pat
Re: Using Unicode symbols in posts
April 05, 2013 04:16PM
Error: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' (1267): SELECT user_id
	         FROM   xy table
	         WHERE username = 'xyz'  LIMIT 1
Back trace:
Function phorum_database_error called at
{path to Phorum}/include/db/mysql/mysqli.php:212
----
Function phorum_db_interact called at
{path to Phorum}/include/db/mysql.php:3656
----
Function phorum_db_user_search called at
{path to Phorum}/include/api/user.php:1240
----
Function phorum_api_user_search called at
{path to Phorum}/register.php:108

... it happened when people where using utf8-characters in a post (Greek-Letters), tricky thing is it looks good in the preview but throws an error in the db. I would really like to change the db tu utf-8 but unfortunatly it needs a conversion-script for phorum which I'm not capable of writing.

pat
Re: Using Unicode symbols in posts
April 06, 2013 04:56AM
A while back, I have written a script to handle converting data in Phorum tables to UTF-8. Maybe this can help you?

[secretsauce.phorum.org]


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
pat
Re: Using Unicode symbols in posts
April 07, 2013 03:56AM
Great! Thank you I'll give it a try.
Re: Using Unicode symbols in posts
January 06, 2014 05:50PM
I used your script to convert the DB, but now it crops everything after a special character. For example, when posting this: "It is recommended that water heaters be kept at a minimum of 60°C (140°F)," everything after the degree symbol is dropped. It doesn't throw an error, but the result is not what is expected. I've searched Google, and tried several other things, but the issue persists. Do you have any ideas/suggestions?
Re: Using Unicode symbols in posts
January 07, 2014 12:52AM
what is the charset setting in your language file?
what the character set setting in your include/db/config.php ?


Thomas Seifert
Re: Using Unicode symbols in posts
January 07, 2014 01:08PM
@Thomas,

In my language file, it was 'iso-8859-1' so I changed it to 'UTF-8' and now it's working. No more cropping the input after a special char!

Thank you.
pat
Re: Using Unicode symbols in posts
January 12, 2014 07:11AM
Hi,

Quote
psguser
I used your script to convert the DB

did it work for you? I get lots of Warnings like that:

#!/usr/bin/php CONVERT banlists CONVERT files CONVERT forum_group_xref CONVERT forums CONVERT groups CONVERT messages CONVERT messages_edittrack CONVERT pm_buddies CONVERT pm_folders CONVERT pm_messages CONVERT pm_xref CONVERT search CONVERT settings CONVERT spamhurdles CONVERT subscribers CONVERT user_custom_fields CONVERT user_group_xref CONVERT user_newflags CONVERT user_permissions CONVERT users FIX: moderator_data in users FIX: settings_data in users FIX: meta data in pm_messages
Notice: unserialize() [function.unserialize]: Error at offset 115 of 119 bytes in \htdocs\phorum\convert_to_utf8.php on line 141

Warning: array_walk_recursive() expects parameter 1 to be array, boolean given in \htdocs\phorum\convert_to_utf8.php on line 143

Notice: unserialize() [function.unserialize]: Error at offset 117 of 121 bytes in \htdocs\phorum\convert_to_utf8.php on line 141

Warning: array_walk_recursive() expects parameter 1 to be array, boolean given in \htdocs\phorum\convert_to_utf8.php on line 143

Notice: unserialize() [function.unserialize]: Error at offset 115 of 119 bytes in \htdocs\phorum\convert_to_utf8.php on line 141

Warning: array_walk_recursive() expects parameter 1 to be array, boolean given in \htdocs\phorum\convert_to_utf8.php on line 143

Notice: unserialize() [function.unserialize]: Error at offset 115 of 119 bytes in \htdocs\phorum\convert_to_utf8.php on line 141

Warning: array_walk_recursive() expects parameter 1 to be array, boolean given in \htdocs\phorum\convert_to_utf8.php on line 143

Notice: unserialize() [function.unserialize]: Error at offset 127 of 131 bytes in \htdocs\phorum\convert_to_utf8.php on line 141

Warning: array_walk_recursive() expects parameter 1 to be array, boolean given in \htdocs\phorum\convert_to_utf8.php on line 143

Notice: unserialize() [function.unserialize]: Error at offset 115 of 119 bytes in \htdocs\phorum\convert_to_utf8.php on line 141

Warning: array_walk_recursive() expects parameter 1 to be array, boolean given in \htdocs\phorum\convert_to_utf8.php on line 143

...and so on

But I'm not sure if that is serious as they are only Warnings and Notices on the other hand it says Error.

pat
Sorry, only registered users may post in this forum.

Click here to login