UTF8 lost in translation, HTML form from/to mysql - mysql

An HTML form with utf-8 charset is stored TO a mysql db (in linux and windows)
then the form is filled FROM that DB, and surprise!
the ó simbol I've stored becomes an ugly �
Any idea of what can be happening?
I've configured my.ini default-character-set=UTF8, the same with php.ini with default_charset = "utf-8"
I've added <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
to the HTML
I've tried to use php iconv function, utf8_encode, configured collation to utf8...
I don't know what is happening with the utf8, thanks for any advice

Does the varchar or text field used to store the value have a collation from the utf8 group (such as utf8_unicode_ci) If not, chances are your string is being stored in a single-byte character collation, giving you the bad result.

Related

tinybutstrong not showing special characters from mysql

I'm trying to load data from a MySQL DB from a varchar(35) / utf8_swedish_ci field through TBS (tinybutstrong) and PHP using the example (MySQL data merge). My issue is that data loads fine if only ascii characters are in the fields but as soon as I add a single scandinavian special character like ö or ä the field contents vanishes entirely and other fields in row display correctly.
My understanding is that the latest versions on TBS automatically use UTF-8 coding (I have 3.9.0 for PHP 5) so I assumed it would work out-of-the-box. To be safe, I even added the coding to template as so:
'$TBS->LoadTemplate('mysql.html','UTF-8');' but to no avail.
Could someone please advice what is causing this.
For a good UTF-8 processing, all elements of the chain must be UTF-8.
You have to ensure that your template is UTF-8 : check the entered text and the HTML element <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
You have to ensure that all your PHP scripts are UTF-8 and not Ansi.
You also have to ensure that your MySQL connection is set to receive UTF-8 queries and to return UTF-8 item data. This can be done for example by querying the SQL : SET NAMES 'UTF8'

Codeiginter mysql storing chinese characters as questions marks

When I type in chinese characters to store in the database, it becomes ??? question marks instead.
Anyone can help me with this?
My codeigniter config settings for char set is
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_unicode_ci';
my meta tag is as below as well
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
This issue occur when you have not set the table charset to utf8. Check your table and set its Chartset to utf-8 and collation to utf8_general_ci or utf8_unicode_ci (which is best for your language :) ).
This will fix the issue.
Thank you

Mysql charset and form

I have a problem with MySQL and charsets .
When I insert something into my mysql database, the special chars like "é" change into "è" and some other strange character combinations...
Searching on the web, I read about set utf8_unicode_ci tables and general configuration. I also added the following line to my webpage
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
But after all this it always returns the same error when I insert something into the database. The characters are still garbled.
What do I miss?
You might want to add this to your code:
mysql_query("SET CHARACTER SET utf8");
It will tell PHP to use Unicode to talk with the database engine. So if your form data encoding is unicode too, you shouldn't have any garbled characters problems anymore.

How to configure mysql version '5.1.49-1ubuntu8' to show multibyte charecters?

am using MySQL version 5.1.49 and I have not enabled UTF8 character encoding. The default character-set for MySQL is latin1. How can I change it show UTF8 characters?
Even when I query a table using Workbench I get 'NULL' in name section which I want, should display mutibyte characters.
ALTER DATABASE DEFAULT CHARACTER SET utf8
and for each table:
ALTER TABLE SomeTableName DEFAULT CHARACTER SET utf8
also if you will be viewing them from a webpage the HTML need this:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
and if you are using PHP, use htmlspecialchars() to display the values like this:
echo htmlspecialchars($row['some_field'], ENT_COMPAT, 'UTF-8');
and (again only for PHP) do this after mysql_connect():
mysql_query("SET NAMES 'utf8'");

Inserting Chinese Meta Tags

I have a multilingual site and I am having a problem inserting Chinese meta tags. These are transformed into question marks.
Is there a way how I can achieve this?
Many thanks
--EDIT--
The table storing the SEF Urls is in the latin1_swedish_ci character set. How can I change this single table to utf8_general_ci without breaking the URLs?
Many thanks!
Make sure that:
The character encoding you are using includes those characters (UTF-8 is safe)
Your editor is configured to use that character encoding
Your database (if these details are stored in one) is configured to use that encoding
Your webserver is configured to output a charset parameter on the Content-type header (and it uses the correct encoding)
Your browser is not configured to ignore the specified encoding
Use numeric character references.
EDIT
wiki numeric character references
Convert Chinese characters to Unicode
Are you retrieving the data from a database?
If so ensure that you connection character set is also set to utf-8.
In MySQL for example you would need to issue this query before any other:
SET NAMES 'utf8';
It could be that you need to encode the Chinese characters to HTML entities, or specify a character set.
Have you checked your character set in your document headers? I usually use UTF-8 to achieve chinese character sets.
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
If you're using a program like dreamweaver, make sure your files are actually being SAVED in the correct character set as well. We had a problem where characters in a dreamweaver file were coming through as ???? because the editor itself was set to iso-8859-1
Maybe your Browser - or more exactly, the font you selected to display the page - doesn't support chinese characters. What system and browser is this on?