Skip to main content
New Participant
September 17, 2008
Question

Japanese Characters (shift_jis)

  • September 17, 2008
  • 3 replies
  • 485 views
I have a client who use Coldfusion 5 and the pages are encoded with Shift_JIS character set. I'm testing the internal site with CF 8 right now but facing many problems. First the client does not want to convert both cfm pages and database to UTF-8 so I have to use existing setup. Since CF5 used ISO-8859-1 as default, I had to put <cfcontent type="text/html; charset=iso-8859-1"> into Application.cfm to read correctly from database and CFM pages. However I have to change the browser encoding to Shift_jis in order to display correct Japanese characters. If I use Shift_jis to cfcontent then it displays garbage.

Therefore here is my question.
1. Is there any way to make CF8 to behave like CF5 on character set?
2. Or how can I force browser encoding to Shift_jis from above? Is there way to make <META http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> to work in CF8?
3. Any other ideas you have that I can try?

Thanks in advance.
    This topic has been closed for replies.

    3 replies

    Inspiring
    September 19, 2008
    gosoojj wrote:
    > Thanks for great answer!
    > I will try to convince a client to upgrade it to unicode site now.

    as i said you can still use that japanese codepage but that's not how things are
    usually done these days.
    gosoojjAuthor
    New Participant
    September 18, 2008
    Thanks for great answer!
    I will try to convince a client to upgrade it to unicode site now.
    Inspiring
    September 18, 2008
    gosoojj wrote:
    > I have a client who use Coldfusion 5 and the pages are encoded with Shift_JIS
    > character set. I'm testing the internal site with CF 8 right now but facing
    > many problems. First the client does not want to convert both cfm pages and
    > database to UTF-8 so I have to use existing setup. Since CF5 used ISO-8859-1 as
    > default, I had to put <cfcontent type="text/html; charset=iso-8859-1"> into

    how was the text stored in the database? what db? what data type for the text
    columns? what db driver are you using in cf8? it sounds like the text data is
    garbaged as far as s/w other than cf5 is concerned (this was a common problem
    when cf6 came out, all of us who "cheated" to get cf5 to work w/non latin-1
    charsets got bit on the rear end when it came time to upgrade).

    > Application.cfm to read correctly from database and CFM pages. However I have
    > to change the browser encoding to Shift_jis in order to display correct
    > Japanese characters. If I use Shift_jis to cfcontent then it displays garbage.

    yup, get ready for some pain.

    > Therefore here is my question.
    > 1. Is there any way to make CF8 to behave like CF5 on character set?

    nope & it's not really something you should want to do anyway.

    > 2. Or how can I force browser encoding to Shift_jis from above? Is there way
    > to make <META http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
    > to work in CF8?

    meta header tags have no effect on cf.

    > 3. Any other ideas you have that I can try?

    depends on the answers to my questions, especially how the data was stored. but
    based on past experiences its probably going to be something like:
    - dump out the text data using cf5 so it comes out readable as shift_JIS.
    - correct the database so it properly handles national charsets/unicode, don't
    worry you can still use shift_JIS (though in spite of your client's wishes i'd
    recommend swapping to unicode at this stage).
    - using cf8 or your db's tool re-insert the text data into the corrected
    database using a JDBC driver (most of the named db drivers in cf are JDBC ones)
    properly setup to handle your encoding (shift_JIS or unicode).
    - swap the app to cf8.

    you can set the app to use shift_JIS either page-by-page (cfProcessingDirective)
    or swap the whole server using info found in this article (see page 2)

    http://www.adobe.com/devnet/coldfusion/articles/globalize.html