Hi, All

I design a website using Utf-8. I use PHP and Mysql. Version Mysql 4.0.12-max-debug for Win95/Win98 on i32. But I want to convert Mysql data to Sql server 2000. I want to store utf-8 data in sql server. Unfortunately SQL server2000 and access use i different Unicode encoding (UCS-2) and do not recognize UTF-8 as valid character data.

I tried mb_convert_string of PHP
mb_convert_encoding($str, "UCS-2", "UTF-8");

However, result of this function is not good.

How do i convert utf-8 to ucs-2 and vice versa? Can I help you an algorithm convert utf-8 to ucs-2 and vice versa?

Sorry, my English is not well.

Thanks for all your help

    a month later

    Hi!

    Did you find a solution for your problem? I have the same one now. I tried very many things, but there doesn't seem to be a way of doing this right... :-/

    Greetings,
    Daniel

      If someone is interested in the solution:

      Use OpenOffice Spreadsheet to save the XLS as UTF-8-CSV. Then read the CSV with PHP and transform the strings with

      [B]mb_convert_encoding($String, "UCS-2", "UTF-8");[/B]

      from UTF-8 to UCS-2 and write them to the database.

      Same thing the other way for reading and displaying:

      [B]mb_convert_encoding($String, "UTF-8", "UCS-2");[/B]

      Don't forget the HTML-Tag to define the content type:

      [B]<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">[/B]

      If you want to use the function mb_convert_encoding you have to enable the mbstring extension of PHP. For Windows just uncomment the php_mbstring.dll in the php.ini.

      See the PHP reference for details: http://www.php.net/manual/en/ref.mbstring.php

      Greetings,
      Daniel

        Write a Reply...