Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

OK so I have a PHP file with several strings of text in various languages. For most languages like French or Spanish I just simply type in the characters.

The problem I have is with Russian language characters. The PHP file is encoded in UTF-8, how can I make sure that the Russian characters are both saved correctly and displayed correctly on the output web page... Is it just a case of pasting the text into the PHP file, or is there a way to guarantee the characters will be saved into the file correctly - perhaps converting it into HTML-like notation for example?

Obviously I am assuming the end user will have the correct encoding set in their web browser, I just want to make sure I got it all covered from my end.

I am using Notepad++ on Windows to edit my PHP file.

Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
529 views
Welcome To Ask or Share your Answers For Others

1 Answer

If you want to tell browsers your encoding, place it inside your <header> tag:

<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>

Or short version

<meta charset='utf-8'>

That should be pretty enough for Russian characters to be correctly displayed on a webpage.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...