473,657 Members | 2,504 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reading Big5 as ASCII: bad idea?

Our server-side software is reading in Big5-encoded data as ASCII when
the web pages are generated. It seems to work most of the time, since
the HTML meta tag is declaring Big5 as the charset. However, every now
and then certain ASCII characters, like the quote (") for example, gets
read in and creates Javascript errors when the browser renders them.

I think this is a direct side effect of processing our Big5-encoded
files as ASCII. Can anyone confirm my suspicions on this?

I'm thinking perhaps the software should be reading these files as
binary Big5-encoded, instead of ASCII and then the Chinese content
won't be converted to HTML-reserved characters like the troublesome
quote.

Another question: I see in the character chart for Big5 that Latin
letters and characters are supported, including the quote character.
Will a Big5-encoded quote character (not the ASCII quote) cause
Javascript issues as well? I'm hoping that so long as Chinese-only
content is contained in HTML tags using the "lang" attribute set
appropriately (for Chinese), the browser won't attempt to render the
Big5-encoded quote as a Javascript string delimiter.

Thank you.

epp

Jul 23 '05 #1
1 3113
enrique wrote:
Our server-side software is reading in Big5-encoded data as ASCII when
the web pages are generated. It seems to work most of the time, since
the HTML meta tag is declaring Big5 as the charset. However, every now
and then certain ASCII characters, like the quote (") for example, gets
read in and creates Javascript errors when the browser renders them.

I think this is a direct side effect of processing our Big5-encoded
files as ASCII. Can anyone confirm my suspicions on this?


Big 5 doesn't have anything to do with it. Even if the data was ASCII
and was being read as ASCII, if you're generating code like

var address = "58 "Q" Street";

because a data field reads

58 "Q" Street

then you will break the Javascript. On *any* platform this is an issue
with data that contains symbols that are also used within the code to
delimit that data. They need to be escaped. In the example above, you'd
have to have

var address = "58 \"Q\" Street";

Switching to single quotes as the string delimiter wouldn't do any good,
because then you'd have

var name = 'Florence O'Malley';

which you'd have to change to

var name = "Florence O\'Malley';

[follow-ups to comp.lang.javas cript]
Jul 23 '05 #2

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

Similar topics

1
20443
by: Scott Shaw | last post by:
Hi all, I was wondering if you could help out with this problem that I am having. What I am trying to do is detect keyboard input in a while loop without halting/pausing the loop until the key is pressed (without hitting return). I looked at serveral faq's on the net and installed the cspan readkey module and neither seems to work most likey its me since I am getting frustrated. but anyway here's a sample code. while (1) { if...
2
4106
by: Utada P.W. SIU | last post by:
anyone know how to convert big5 character to gb character?? I mean the word is changed physically
2
2961
by: Mullin Yu | last post by:
i try to send a big5-encoded xml request to a java servlet by two ways 1. vb6 => success 2. c# => all chinese character becomes ?????? my c# coding is as following: i wonder will it convert my big5 chinese to utf-8 or utf-16 already before sending. any clue and suggestion:
5
15036
by: Lenard Gunda | last post by:
hi! I have the following problem. I need to read data from a TXT file our company receives. I would use StreamReader, and process it line by line using ReadLine, however, the following problem occurs. The file contains characters with ASCII codes above 128. But the file is still text (nothing like UTF7/8 or the like). It also might contain + signs. As a result:
2
4186
by: James Wong | last post by:
Dear all, I'm using StreamReader to read a text file containing BIG-5 data and found that no matter which encoding method in StreamReader's construction parameter, the BIG-5 contents become garbage under ReadLine method. Does anybody have any idea on this issue? Thanks for your attention and kindly help! Regards,
0
2572
by: CN | last post by:
Hi! My 8.0beta2 database was initialized with option "-E UNICODE". Psql sets client encoding to Big5: database1=# \encoding big5 I get this error when inserting Big5 character 0xf9d8: WARNING: ignoring unconvertible BIG5 character 0xf9d8
5
7588
by: nielsgron | last post by:
Hi, I have created a database on DB2 8.1 and 8.2 for Windows using the codeset "Big5" with the command: db2 CREATE DATABASE TWBIG5 USING CODESET BIG5 TERRITORY TW When I try to connect to the database using the DB2 Universal Type 4 JDBC drivers v2.6 I get an error: "com.ibm.db2.jcc.b.DisconnectException: encoding not supported!!
3
13751
by: GM | last post by:
Dear all, Could you all give me some guide on how to convert my big5 string to unicode using python? I already knew that I might use cjkcodecs or python 2.4 but I still don't have idea on what exactly I should do. Please give me some sample code if you could. Thanks a lot Regards, Gary
7
6840
by: Elliot | last post by:
My XML is using encoding UTF-8 and its content contains Chinese character. When debug the following codes: string strXmlFile = "xml.xml"; XmlDocument objXml = new XmlDocument(); objXml.Load(strXmlFile); It returns "Invalid character in the given encoding" and point to objXml.Load(strXmlFile);.
0
8421
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8844
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8742
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8621
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7354
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1734
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.