Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Charset or convert characters


  • From: liorean at gmail.com (liorean)
  • Subject: [Javascript] Charset or convert characters
  • Date: Tue May 30 15:02:09 2006

On 30/05/06, Jonas Rosling <webmaster@xxxxxxxxxxxx> wrote:
> Is there any way in JS to set any character encodings to text that shell be
> displayed in dialogs for example? Or is there any way to convert it?

JavaScript is entirely Unicode. The source code is parsed into
Unicode, and all characters in strings are Unicode. Try using
str=String.fromCharCode(charcode) or charcode=str.charCodeAt() and
you'll see JavaScript handles international characters just fine.

> I keep having problems with displaying none international characters like ?,
> ? and ?.

My guess would be that your problem lies with what encoding you're
using for your JavaScript source files. Try saving them as UTF-8
(using an editor that allows you to change the encoding of course),
and make sure your server is configured to serve them using the
'application/ecmascript; charset=utf-8' content type or possibly
'application/x-javascript; charset=utf-8'.
-- 
David "liorean" Andersson
<uri:http://liorean.web-graphics.com/>