Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Discussions (General)
 javascript doesn't work when encoded as utf-8
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

bjlt
Senior Member

1144 Posts

Posted - 19 September 2002 :  07:54:51  Show Profile
my site need to support multiple languages at the same time, i.e. show them on the same page, so I set the metatag to utf-8
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

then one page where there's a block of javascript stop working.
you can see it here:
utf-8 encoding - not working
http://beijinglife.com/misc/lunar_calendar.asp

change your browser's coding method to one not utf-8 it shows up.

also, removed the meta tag and it's working
http://beijinglife.com/misc/lunar_calendar2.asp


How to solve the problem?
you can see the javascript by viewing the source, there's one linked which is
/js/lunar_calendar_worldtime_en1.js

thanks in advance.

Edited by - bjlt on 19 September 2002 07:59:19

Deleted
deleted

4116 Posts

Posted - 19 September 2002 :  10:56:29  Show Profile
Interesting.

Did you try to save your ASP file and/or JS file in UTF-8 encoding? I downloaded the JS file and it was ANSI...

We didn't have any problem with Snitz inc_code.asp, where the JS code is generated through ASP. But the strings were kept in LangNNNN.asp files. I don't remember any problem with them even if people are using UTF-8 encoding and saved their language files in UTF-8.

Stop the WAR!
Go to Top of Page

bjlt
Senior Member

1144 Posts

Posted - 19 September 2002 :  11:32:29  Show Profile

Thanks.

I saved the asp file as utf-8 but forgot the external js one.

well, I still have question on this.

1. Do I have to save all files as utf-8?

2. If I save the asp file as utf-8 format, do I still have to use
@codepage=65001
on every page?

3. Also, if I write <meta http-equiv="Content-Type" content="text/html; charset=utf-8">, do I still need to use Response.CharSet = "utf-8", or vice versa?

4. Are there a batch way to save all files as utf-8?

Thanks.

Edited by - bjlt on 19 September 2002 11:38:37
Go to Top of Page

Deleted
deleted

4116 Posts

Posted - 19 September 2002 :  12:19:51  Show Profile
So, did it work when you saved JS as utf-8?

I'm not sure I can answer all your questions, there are problems on some systems about Chinese/Japanese, but here you go.

1) If you have characters that need utf-8 encoding in a file, you have to save it in utf-8

2 & 3) I don't think they are necessary but I'm not sure. Perhaps Leorat can answer this more easily. He played with these a lot (i.e. with Japanese content)...

4) None as par as I know. I just open using w2k notepad and save it as utf-8.

Stop the WAR!
Go to Top of Page

bjlt
Senior Member

1144 Posts

Posted - 19 September 2002 :  13:16:48  Show Profile
Yes, now it works, thanks.
Go to Top of Page

n/a
deleted

593 Posts

Posted - 19 September 2002 :  16:16:47  Show Profile
Hi,
Sort of re-stating what Bozden said:
About unicode usage in Snitz -
1) V4bxxx....if you use utf-8/doublebyte unicode, along with <meta http-equiv="Content-Type" content="text/html; charset=utf-8">, you are basically defining text formatting in html with doublebyte unicode charsets, so you should be concnered only with "language resource file text strings" - this means all langxxxxx.asp should be saved in utf-8 encoded asp file. You don't need to do this for program code asp files...except defining html charset encoding with a meta tag definition...which can be done in inc_header.asp. You don't need to convert all asp files/pages into utf-8 or saved in utf-8 encoded format files. This allows user interface and contents appear in unicoded charsets - and content wise pretty much in any unicode supported charsets...including Far Eastern doublebyte charsets like Japanese, Chinese, and Korean. (I am running V4b005 with Japanese, T. Chinese, S. Chinese with UTF-8, with Events Calendar internationalized and supporting these 3 floavors of Asian doublebyte langs....)
2) V3.x - by simply defining a base html encoding systemw with unicode...<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> ..in inc_header.asp, you basically have an English i/f but all unicode enabled contents... (I am running V3.4.03 with unicode, using English_US and Japanese pretty much as the "base" language sets)...

I am using date/time javascript in both forums/web pages and other, and didn't have any problems. Encoding is concerned primarily "contents" or text information for more of "localizaiton" requirements, and does not necessarily come across "internationalization" aspects of software development, which handles software architecture, programming, code design, etc. to enable to handle different international/locale requirements like date/time format....

I see you use V3.x Snitz Forum?

FYI: i2Asia Multilingual Forum


Have fun.


Taku
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.21 seconds. Powered By: Snitz Forums 2000 Version 3.4.07