четвъртък, 19 юли 2007 г.

External JavaScript Character Set Encoding for Firefox and Internet Explorer

The SCRIPT tag has an attribute "charset" which can be set to a specific encoding so the browser knows how to interpret the external JavaScript file. This works fine with Firefox, but not with IE.

I have found that for me to force IE to display non-English characters from an external JavaScript file, where a dynamic element is added to the page on the fly, the best way to handle this is via the "native2ascii" application from JDK.

native2ascii somefile.js

will encode any non-ASCII characters with their Unicode equivalents, so the browser will convert them correctly to the actual text.

Няма коментари: