473,388 Members | 1,383 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

javascript charset <> page charset

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?
Aug 14 '08 #1
2 5878
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
Aug 14 '08 #2
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.
Aug 15 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are...
3
by: John Telford | last post by:
I know this sound strange. I need is to convert a JavaScript Web site into HTML so Atomz <http://www.atomz.com/> can generate a search index for the site. Is there such a utility? ...John...
4
by: Guillaume CABANAC | last post by:
Hi everybody, Does anybody know how to access a remote database (say Oracle) from JavaScript code (within a Firefox Extension) ? I know ADO via ActiveX in the IE world and think a similar...
3
by: z. f. | last post by:
Hi, i'm using code in my aspx page. i have data binding where i use <%# Container.DataItem("DateStart") %> i also use code that makes a loop inside a regular <% %> block how can i pass...
4
by: Neil Zanella | last post by:
Hello, I would like to know what the difference is among the constructs <%= %> for evaluating an expression and displaying the evaluated result on the page and <%# %>. In particular I would like...
3
by: | last post by:
I have been researching articles on google on how to create a simple RSS feed that sucks <title><blurb><link><date> out of a sql server 2000 database via an aspx page. I know it has to be pushed...
3
by: ajay2552 | last post by:
Hi, I have a query. All html tags start with < and end with >. Suppose i want to display either '<' or '>' or say some text like '<Company>' in html how do i do it? One method is to use &lt,...
2
by: -Karl | last post by:
Couls someone please advise me on this error. What I am trying to do is be able to convert an XML document into arrays. I read that the subs & functions have to be in <scripttags. Thanks! ...
9
by: ajos | last post by:
hi all, im getting some problems in my javascript validations..... my jsp code--> 8: <head> 9: <title>Budget Master Administration</title> 10: <meta name="GENERATOR" content="Microsoft...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.