By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,624 Members | 1,737 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,624 IT Pros & Developers. It's quick & easy.

UTF-8 to Shift JIS

P: n/a
I need to convert an UTF-8 string to Shift-JIS in a web page
(preferably using JavaScript).
Any ideas?
thanks
Ed Brandmark
Jul 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
> I need to convert an UTF-8 string to Shift-JIS in a web page
(preferably using JavaScript).


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?

http://www.crockford.com

Jul 20 '05 #2

P: n/a
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 encodeURIComponent to do this - and it seems there
is a decodeURICompoenent that may work.
in other cases (older browsers that don't understand encodeURIComponent)
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!
Jul 20 '05 #3

P: n/a
Hi, this may or may not help, but I thought I would throw it out there

http://msdn.microsoft.com/workshop/a...es/imemode.asp
Jul 20 '05 #4

P: n/a


Thanks
Ed Brandmark

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.