Results 1 to 3 of 3
  1. #1
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Script Errors and Character Set

    Just a note about a frustrating problem I bumped into this morning, and a question.

    We have an intranet application that has been in use for several years that displays various information from our accounting system. While testing a few updates, I discovered some severe script errors on one page that no one had ever reported as a problem. When I viewed the page in the Microsoft Script De######, one of the test strings was in Chinese (maybe) and all the + signs disappeared from the concatenation operations.

    Well, it turned out that because I never specified a particular character set in the page, the browser was picking up something from the database for this particular (varchar?) field that caused it to interpret the page as Unicode UTF-7, and that completely wrecked the scripts.

    For this application, which only runs in IE because it requires NT credentials to access the server, I added this to each page at the top of the <head> section:

    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=Windows-1252">

    That's "Western European (Windows)"; more IE-specific CHARSET strings are listed in HTML and Dynamic HTML > Reference > Character Set Recognition on MSDN.

    Question: Is there is a standardized cross-browser solution?

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Script Errors and Character Set

    I once built a multi-lingual application (English, Spanish, Japanese, Chinese Simplified, Chinese Traditional, French, German). All of the data was stored in SQL Server in nvarchar fields. I was able to accommodate multiple browsers and languages by using serveral things:

    ASP Side:
    Response.CharSet = "utf-8"
    Response.ContentType = "text/html"

    HTML Side:
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    As I recall, UTF-8 was the key. Once I added that to the mix, everything displayed perfectly - even in Netscape!

    Hope this helps!

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Script Errors and Character Set

    Yup, UTF-8 CHARSET works, too...at least so far as avoiding those JavaScript errors. I'll have to check some other pages to see if it changes anything.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •