PHP convert foreign characters with accents

后端 未结 5 1288
有刺的猬
有刺的猬 2020-12-16 08:03

Hi I\'m trying to compare some text to the text in a database.. in the database any text with an accent is encoded like in html (ie. é) when I compare the databas

5条回答
  •  天涯浪人
    2020-12-16 08:39

    The comparing task is related to the charset and the collation you selected when you create the database or the tables. If you are saving strings with a lot of accents like spanish I sugget you to use charset uft8 and the collation could be the more accurate to the language(english, french or whatever) you're using.

    The best thing of using the correct charset in the database is that you can save the string in natural way e.g: my name I can store it as is "Mario Juárez" and I have no need of doing some weird conversions.

提交回复
热议问题