[freetds] Re: Problem of unicode ( Inserted data / Query )
Daniel Fazekas
fdsubs at axelero.hu
Mon Mar 29 11:57:15 EST 2004
On Mar 29, 2004, at 18:17, edwardspl at ita.org.mo wrote:
> Dear You,
> How to control php convert inserted data or query to / from MS-SQL (
> MUST in
> charset of unicode ) ?
Please, Edward, for Christ's sake, just tell us already what your
*problem* is and what are you trying to do.
There are dozens of places and ways to do a character encoding
translation.
If it is a web application, which we can't know for sure as you are
really secretive about what you are trying to accomplish, then you
could simply serve the html page with the character encoding you
desire.
You can do that by adding a
<meta http-equiv="content-type" content="text/html; charset=utf-8">
inside the <head> ... </head> part of your page. Or, you could do the
same with PHP, *before outputting any data*, by modifying the http
response headers like this:
<?php
header('Content-type: text/html; charset=utf-8');
?>
If you did this, the character encoding conversion's task is up to the
client's browser. You receive the client's reply in the same character
encoding you used for your page.
If, for some reason you still have to convert it afterwards, you can
use the iconv extension in php:
http://www.php.net/iconv
And finally, you can get FreeTDS to do the conversion for you, by
setting the character encoding in the freetds.conf file, as James
described to you several times over, on every second day the past
couple of months.
> A client user ( using his/her own language ) insert some data into
> MS-SQL,
> then MS-SQL MUST store the data ( which come from the client user ) in
> unicode
> format ( charset ).
Where and how is that client inserting the data into the database?
A web application?
What's your problem? What isn't working the way you'd like it to?
> A client user ( using his/her own language ) search some info from
> MS-SQL, but
> all of the format of stored data were unicode ( charset ), so must
> convert the
> charset of unicode to a special format ( charset ) for the client user
> (
> correspond to his/her own language )
No, you don't have to convert anything usually. Any web browser on any
operating system released in the past couple days can display unicode
web pages just fine.
--
fds
More information about the FreeTDS
mailing list