> I need to convert an UTF-8 string to Shift-JIS in a web page[color=blue]
> (preferably using JavaScript).[/color]
I'm curious why? One of the services that the browser provides is automatic
conversion of character encodings, so that scripts can deal exclusively in
Unicode, which is a very, very good thing. Normally, encodings are specified in
http headers and it all works out. Why doesn't that work for you?
This is part of an ad call where a Japanese web page is encoding what
the user typed in as a search term.
This needs to be encoded in UTF-8 for our server to be able to
understand the search term - and thus pick a relevant ad.
Then in some of the ads, they want to put the search term right back in
the ad - so for an amazon ad - it could say click here to find books
about ...
well the term that gets put back there is the term they converted to
UTF-8. when their web page then displays this - it is not converted
correctly - thus we must convert it back to Shift-JIS before displaying
it.
in some cases i use encodeURICompon ent to do this - and it seems there
is a decodeURICompoe nent that may work.
in other cases (older browsers that don't understand encodeURICompon ent)
they use a home grown routine - which I guess we will have to reverse?
thanks
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Comment