Problem storing german chars in the MySQL database.....?
I have a table named "cust_details" which has a column "categories", where I have to store some categories like : blockadenlösung, affirmation, beziehungsprobleme lösen
But when I am trying to save this data into the database it is stored like :
blockadenlüsung, affirmation, beziehungsprobleme lösen
That is when umlauts are coming in the s开发者_Go百科tring it is not saved in its original form. I tried some charset for storing this characters. But I am still facing the problem.....
What may be the possible reasons...?
Thanks In Advance.....
The data you stored is encoded in UTF-8 (ü for an "ö" is typical for UTF-8), but is not displayed as UTF-8 but rather as ISO-8859-1 or the like.
Make sure that you use the same encoding everywhere:
- Deliver your websites with Content-Encoding "utf-8"
- Use mysql_query("SET NAMES 'utf8'"); to set the encoding to utf-8
- Make sure that the encoding of the database is UTF-8 (use HeidiSQL etc. to check)
Use this when you are inserting the characters:
N'characters here'
The N before the string declaration should enable you to enter it into the DB.
What is the type of the field?
You could specify database/table/field level character-sets. The default latin-1
works in most scenarios.
Otherwise, you would have to use plain text and store unicode strings like &#<4-digit-unicode-value>;
into it. Then when you print it out, just dump the unicode into HTML and it will show up as such.
Here is a sample string in Pashto ترافيکي پيښو کې درې تنه مړه او څوارلس نور ټپيان شول.
which we store directy into the table. The charset used is latin_charset_ci
Good Luck!
精彩评论