简体   繁体   中英

What is the “best practice” for choosing character encoding with PHP/MySQL applications?

I'm self-taught php programmer, so I often don't know the "correct" way to do something. I want to normalize my character encoding practices between my PHP, HTML, and MySQL data.

-- live in the US,
-- work on sites for people who speak English,
-- most foreign languages I will encounter are western (Spanish, Italian, French)
-- living near NYC I could encounter Hebrew, Russian, etc. though I'd avoid using their character system and would only use whatever accents necessary to use Latin characters.

Anyone want to comment on which I should choose UTF-8 or ISO-8859-1? Or something else? Chris

IMHO it's always best to work with UTF-8. Your preferences will not always reflect your users' preferences, which might happen to really like hebrew or Russian. שלום!

If your application is going to support only one language - it's better to use that language's native encoding. With two or more - consider UTF-8.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM