DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Special characters problem.

  1. #1
    Join Date
    Nov 2007

    Special characters problem.


    I have a problem with some special characters with my Ajax application. I use an asp-site which use a javascript to query a database by requesting an asp-file to print some html which I then display by using innerhtml. The asp-file uses vbscript and the Response.Write-syntax.

    A part of the javascript looks like this:

    var url="getsupps.asp";

    function stateChanged()
    if (xmlHttp.readyState==4)

    In Firefox, each special character is replaced by a '�', whichever character encoding I use on the first page, I guess this encoding doesn't apply to the innerhtml. In IE6 these special characters are replaced by a '?' and also replacing the coming 3 characters after the special character, i.e. 'sample text' = 'sample ?xt'.

    I've searched for an answer for quite some time now but can't find an answer, thanks for your time!


  2. #2
    Join Date
    Nov 2007

    XMLHttp.responseText replies wrong chars


    I just realized that the responseText replies the wrong chars, and it replies the wrong chars based on browser. I've tried to set encoding on the xmlHttp-"request" by using:
    xmlHttp.setRequestHeader("Content-Type", "charset=iso-8859-1");
    but it doesn't make any difference. Are there any other ways to control the information transaction between the javascript and the asp-file?

  3. #3
    Join Date
    Mar 2007
    Bangalore, India
    There a couple of things you have to check. I am assuming that you know what character encoding is all about and that you are not trying to display characters in other languages with the charset iso8859-1.

    1) See that there is some font with the required character installed in your computer. (In Windows, Arial Unicode MS has almost all the characters).
    2) Are you hard coding the character in the IDE in your editor itself? Make sure that your IDE supports saving of files in UTF-8 or ISO8859-1 or other encoding.
    3) Do you need to use a different font (not charcter encoding) to see that font?
    4) Try setting the encoding to UTF-8 or UTF-16.

    The 3rd option is a rare occurance, when non-unicode characters are used.
    One of UTF-8 or UTF-16 is STRONGLY recommended for multiple languages / characters in other languages. If most of your content is in English, go for UTF-8. If most of it is in other languages / character set than those included in ASCII, go for UTF-16. I strongly think the problem has to do with fonts not being installed in the client machine (where you have the browser), because of the ? appearing.


    5) It may also be done by the IDE when it doesn't support saving files in other charsets. In that case, try using the
    way of outputting the character, where xxxx is the unicode value of the character (which you can get from the charmap utility in Windows.

Similar Threads

  1. Dealing with SQL special characters with Java
    By michealt17 in forum Java
    Replies: 0
    Last Post: 07-12-2005, 11:35 AM
  2. Java Applet Compiler problem?
    By mdl in forum Java
    Replies: 3
    Last Post: 03-07-2005, 03:34 AM
  3. Reliability Problem
    By elise in forum Java
    Replies: 0
    Last Post: 10-30-2002, 05:40 AM
  4. special characters in XML
    By marlene leach in forum XML
    Replies: 1
    Last Post: 08-09-2001, 04:31 PM
  5. Replies: 0
    Last Post: 06-23-2000, 02:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center