Cara menggunakan php cyrillic encoding

  1. Problems with displaying Russian characters and UTF-8

    Hello all!!

    I have been dealing here with a problem that probably someone has already been fighting with too and I need some advisory/explanations on how can I manage to put the three languages of my website to work all together! :) I have Portugues, English and Russia. I read, in the MySQL documentation that UTF-8 supports up to 650 languages and I decided to try to use this character set for my website. So, what did I do? I created a fresh database, being its collation and character set utf8_general_ci. I exported the old database to a .sql file. Changed all the occurrences of 'latin1', the default charset of MySQL, to 'utf8'. Imported this file to the new database and voil�!! All database tables are in utf8_general_ci. Now the problems started... first, when I go to the admin area and try to create a new category, I write the category name in russian but in the database it shows up like this :

    & # 1041;& # 1080;& # 1085;& # 1086;& # 1082;& # 1083;& # 1080;

    It was showing up like this before, before I changed all to utf8. So, what I decided? That I could edit the field by my own... I edited and changed this bunch of characters to "Бинокли", and when I get back to the site just a bunch of "???????" shows up... With Portuguese also happens the same... all the words with punctuation shows with a ? sign, for example "Bin?culos", when it should be "Bin�culos".

    Can anyone tell me what is the problem? How can I put all languages compatible? How can I put the database to write Russian characters? Is it some problem in the pages when they are connecting to the database server? How to correct it? I know nothing about PHP, unfortunately ... And another problem here is that search in Russian will not work for sure if in the database all this strange characters are being written...

    Thank you all for a solution to this problem...

    Cheers !

  2. Re: Problems with displaying Russian characters and UTF-8

    For anyone that comes up with this same problem, I managed to solve my problem in a "simple" way. I had to migrate all my site, but now everything is working, and russian and portuguese characters are being inserted into the database correctly!
    I am glad this problem showed up now and not in the future, let me say!

    So, what did I do?

    First of all, I started by reading this very useful tutorial (for me at least) Thank you!

    So, after I have followed all the instructions in the link above and verified that my site was all being sent to the browsers in UTF8, I started to install the other languages. First Russian, which, fortunately, a member of this forum supplied to me in UTF8

    . It was just the regular process of installing a language, all went fine! After installing the language and to test if russian characters were being inserted into the database correctly, I created a test category with a russian name and went to verify the database and finally all was being written correctly! Russian characters instead of a bunch of code! After installing the russian language and verifying that all was correct, it was time for the portuguese language. This gave me a bit more work, because I had to edit all files and convert them to UTF8. But ok, now all is working too!

    After my languages were working fine it was time

    to migrate all my old site to this new. template, settings, database. gave me some work but after 2 days, more or less, all was complete and the site is again healthy and all is being encoded properly. Search is also working for the 3 languages and I am very happy with it!! :)

  3. Re: Problems with displaying Russian characters and UTF-8

    Well done of getting to the bottom of a complex and difficult issue.

    Thanks for taking the time to post this explanation and show not only how to resolve the issue, but also what a little persistence and research can do, and how much help is out there even if it's not always easy to to uncover.

  4. Re: Problems with displaying Russian characters and UTF-8

  5. Re: Problems with displaying Russian characters and UTF-8

    Hi pcontente,

    Glad my little tutorial helped you there. Sorry I didn't see your question on here before you had to bang your head on your desk. But, that way is sometimes the best. It's nice after you can't do it for a couple of days, and then you find something, and it works.

    Also great post, its always nice when people post their answers.



  6. Re: Problems with displaying Russian characters and UTF-8

    I have done all things as describde.In an English template i can write Russian characters (example "category" Тюдпаны) but when i change to a Russin language template then the Russian is like arabic unreadable ( category " РўСЋР�РїР�РЅС�" .
    If i look in the russian Template
    Page source is charset=windows-1251
    Character encoding is cyrillic windows 1251
    In the English one utf8
    What do i wrong


  7. Re: Problems with displaying Russian characters and UTF-8

    If you set the browser to the correct encoding, does it work?

    For example, in FireFox go to "View->Character Encoding->Find the correct encoding here."

    Does that work for you? Are you working on a live server and have a url you can give us?

    Can you post the source code that shows that gets printed to the browser?

    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

    All that info should help me know what is going on.



  8. Re: Problems with displaying Russian characters and UTF-8

    Все товары
    Отзывы [далее]
    Нет отзывов

    * Отгрузка и возврат товара
    * Уведомление о секретности
    * Условия использования
    * Обратная связь
    * Карта сайта
    * Дисконтные карточки[Помощь]
    * Дисконтные карточки
    * Отписатся от новостной рассылки

    This is a part of the template in russian, I have followed the instruction .
    Ckanged the php to utf8 etc
    If i use only English then all thing are shown correct even with Russian characters
    see below

    * Тюлпаны

    All Products ...
    Reviews [more]
    There are currently no product reviews.

    * Shipping & Returns
    * Privacy Notice
    * Conditions of Use
    * Contact Us
    * Site Map
    * Gift Certificate FAQ
    * Discount Coupons
    * Newsletter Unsubscribe
    So the problem is in the language for filling the category changing the russian php gave no result
    In the russin php
    @setlocale(LC_TIME, 'ru.utf8');
    define('CHARSET', 'windows-1251');
    What can i do to get a readable Russian character in the catalog
    I need much things in there at least 51 pages and with abracadabra it does not sell anything


  9. Re: Problems with displaying Russian characters and UTF-8


    your problem is that you need to change winows-1251 to utf-8.


    Posted via Mobile Device

  10. 22 Jul 2009, 12:33 PM #10

    Re: Problems with displaying Russian characters and UTF-8

    If i do that this is wat i get

    ��� ������
    ������ [�����]
    ��� �������

    * �������� � ������� ������
    * ����������� � �����������
    * ������� �������������
    * �������� �����
    * ����� �����
    * ���������� ��������[������]
    * ���������� ��������
    * ��������� �� ��������� ��������
    The category is now russian but the rest unreadable