开发者

MySQL - Russian characters display incorectly

I have to make an russian version of a website, but I can't find out, how to insert russian characters into Database.

I tryed almost every possible coding, but it only shows:

???????? ?????????? ??????? ??????? ? ????? ?? ????????????? ? ???????, ??????? ????? ??????? ???????? ????? .??? ??????????? ???????? ????? ?? ????? ?????????? ? ????? ????????.
??????????? ?????? ?? ???????? ????? ?? 20 ???????. ???????? ??? ?? ??????????? ?????????????? ????? ? ????????????? ??????? ??????. 开发者_如何学JAVA? ???????, ? ??????? ? ?.?. 


  1. Make sure the database charset/collation is UTF-8
  2. On the page you insert these russian characters ( the form, textarea ), make sure the encoding is UTF-8, by setting Content-Type to text/html; charset=utf-8. Enter in russian text directly to the form input.
  3. On the processing page that handles this form, which inserts it into the database, make sure to do SET NAMES utf8 so it's stored as UTF-8 before you insert the data, in a separate query beforehand.
  4. When you render the content from the database in a view, make sure the Content-Type is text/html; charset=utf-8.

Make sure that the content-type is not windows-1251 or iso-8859-1/latin1. Make sure the database charset/collation is NOT ISO-8859-1/Latin1.


For storing russian characters in db your db should support UTF-8 encoding. Modify your table with below query to enable UTF-8 encoding.

ALTER TABLE t1 CONVERT TO CHARACTER SET utf8
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜