UTF-8 to Shift JIS

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ed Brandmark

    UTF-8 to Shift JIS

    I need to convert an UTF-8 string to Shift-JIS in a web page
    (preferably using JavaScript).
    Any ideas?
    thanks
    Ed Brandmark
  • Douglas Crockford

    #2
    Re: UTF-8 to Shift JIS

    > 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?



    Comment

    • Ed Brandmark

      #3
      Re: UTF-8 to Shift JIS

      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

      • asdf asdf

        #4
        Re: UTF-8 to Shift JIS

        Hi, this may or may not help, but I thought I would throw it out there


        Comment

        • Ed Brandmark

          #5
          Re: UTF-8 to Shift JIS



          Thanks
          Ed Brandmark

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

          Comment

          Working...