Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > javascript charset <> page charset

Reply
Thread Tools

javascript charset <> page charset

 
 
optimistx
Guest
Posts: n/a
 
      08-14-2008
I try to develope a bookmarklet in javascript. The charset of the
bookmarklet is UTF-8, but it is supposed to work within pages, whose
character set is not UTF-8, but e.g. ISO-8859-1 or WINDOWS-1252. The
bookmarklet loads other javascript files with the attribute charset="UTF-8".

Mostly everything works nicely, but at least alert-boxes seem to show
different characters depending on the browser (Firefox 3 , Opera 9.02, ie6
has been compared this far: Opera uses the page character set, ff and ie
js-charset.).

'Feature testing' is a fascinating idea, but how can it be used in this case
or otherwise solv this problem?


 
Reply With Quote
 
 
 
 
Bart Van der Donck
Guest
Posts: n/a
 
      08-14-2008
optimistx wrote:

> I try to develope a bookmarklet in javascript. The charset of the
> bookmarklet is UTF-8, but it is supposed to work within pages, whose
> character set is not UTF-8, but e.g. ISO-8859-1 or WINDOWS-1252. *The
> bookmarklet loads other javascript files with the attribute charset="UTF-8".
>
> Mostly everything works nicely, but at least alert-boxes seem to show
> different characters depending on the browser (Firefox 3 , Opera 9.02, ie6
> has been compared this far: Opera uses the page character set, ff and ie
> js-charset.).


Two ideas: It might be an issue for Opera whether the remote js-file
was saved under UTF-8 or not. It might also matter whether that file
has a charset-header from itself.

When the 'charset'-argument is used for an external script-call, then
this should only indicate how the main caller file will (try to) treat
non-ASCII characters in the remote file (except when UTF-7). And this
should normally stand apart from the encoding that is used in the
caller file.

Hope this helps,

--
Bart
 
Reply With Quote
 
 
 
 
optimistx
Guest
Posts: n/a
 
      08-15-2008
Bart Van der Donck wrote:

> Two ideas: It might be an issue for Opera whether the remote js-file
> was saved under UTF-8 or not. It might also matter whether that file
> has a charset-header from itself.
>
> When the 'charset'-argument is used for an external script-call, then
> this should only indicate how the main caller file will (try to) treat
> non-ASCII characters in the remote file (except when UTF-7). And this
> should normally stand apart from the encoding that is used in the
> caller file.
>
> Hope this helps,


Thanks, your advice helped. After all, there was no discrepancy between
browsers. When the original files really have the character sets which their
http-headers claim they have, and the files are without any 'BOM'- marks,
then the Apache-servers and browsers do their work as expected. The final
alertbox is shown correctly in 3 browsers at least provided that the
entities like &auml; are programmatically replaced by appropriate character
codes.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to change page-level charset to big5 =?Utf-8?B?am9l?= ASP .Net 0 10-25-2006 09:02 AM
Default Charset Encoding in JSP page is ASCII Fritz Bayer Java 1 05-30-2005 06:01 PM
charset in window created from javascript Lõrinczy Zsigmond Javascript 4 12-05-2004 03:24 PM
Re: Displaying Charset windows-1251 Sasha Shevelev ASP .Net 0 07-02-2003 02:37 AM
Language and Direction real GURU needed! (Hebrew and maybe arabic) CR or Charset issue? Efy. ASP .Net 2 06-25-2003 03:28 PM



Advertisments