473,382 Members | 1,107 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,382 software developers and data experts.

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 3094
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.javascript]
Jul 23 '05 #2

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

Similar topics

1
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...
2
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
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...
5
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...
2
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...
0
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: ...
5
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...
3
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...
7
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(); ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.