Javascript problem with document.write and accented characters


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Javascript problem with document.write and accented characters

  1. #1
    Join Date
    Mar 2004
    Posts
    13

    Javascript problem with document.write and accented characters

    Hi,

    I have a web page where I put a javascript and where its source is an ASP.NET application. So it looks like this:

    <script language="javascript" src="/js.aspx type="text/javascript"></script>

    This web page has the meta tag for encoding:

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    The ASP page is printing some document.write with data taken from a database. If I go directly to the js.aspx page, I see this:

    document.write('Mon pre a t l');

    The french accent are there which is good.

    But when I go to my test page, I see things like this:

    "Mon père a ètè lè"

    All the french accent have been converted in a non-readable format.

    I tried to put the charset property to the script tag (charset="iso_8859-1") and it doesn't work. I also check encoding of my ASP page but it still doesn't work.

    After googling a lot in vain, I hope I'm not the only having this problem!

    Any idea or any solution??

    Thanks!

    Stephane

  2. #2
    Join Date
    Jan 2005
    Posts
    413
    I don't think you can have anything but a .js file as the src of a script tag that has javascript as it's type. Also you're missing 2 closing quotes.

  3. #3
    Join Date
    Mar 2004
    Posts
    13
    Hi,

    I've done this a few times with PHP and ASP pages and I didn't have any trouble. But this time with ASPX page, there's a problem with the encoding somewhere... Is there a way to dynamically convert accented charaters using javascript or .net??

    Thanks

    Stephane

  4. #4
    Join Date
    Mar 2004
    Posts
    13
    I've done a lot of things and it's working now... I'm not 100% sure but it seems it's because I added responseEncoding="iso-8859-1" to the ASP.Net Page directive.

    It works now so I won't touch it again!

    Steph

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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

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