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

IE 6 Question Mark Wierdness


Anyone come across anything like this before? This is some javascript
validation of user input.

If ch is a question mark character, the test passes and false is
returned.

if ((ch==">") || (ch=="<") || (ch=="\\") ||
(ch=="|") || (ch=="\"") || (ch=="¦")) {

return false;
}

The problem is that the character '¦' is testing as equal to '?'. This
character is Latin 1 A6.

if ("?"=="¦") { alert("Holy Smoke!"); }

It seems to only happen on IE6 (I've tried 6.0.2800.1106).
Anyone got any thoughts?

Thanks
Andrew Cowper

--
Pick a different user name to email me.
Jul 20 '05 #1
4 3326
Hello, although I can't reproduce your problem, I'd like to suggest
that you could use a hash table to perform the checks.

var map = new Object();
map[">"] = true;
map["|"] = true;
..
..
..

if (map[input]) return found_in_map;
Jul 20 '05 #2
> Hello, although I can't reproduce your problem, I'd like to suggest
that you could use a hash table to perform the checks.

var map = new Object();
map[">"] = true;
map["|"] = true;
....
if (map[input]) return found_in_map;


This is a good place to use the object literal notation.

var map = {'>': true, '|': true, ...};
...
return map[input];

http://www.JSON.org

Jul 20 '05 #3
Andrew Cowper <ju*******@bloat.plus.com> wrote in message news:<87************@bloat.plus.com>...
Anyone come across anything like this before? This is some javascript
validation of user input.

If ch is a question mark character, the test passes and false is
returned.

if ((ch==">") || (ch=="<") || (ch=="\\") ||
(ch=="|") || (ch=="\"") || (ch=="¦")) {

return false;
}

The problem is that the character '¦' is testing as equal to '?'. This
character is Latin 1 A6.

if ("?"=="¦") { alert("Holy Smoke!"); }

It seems to only happen on IE6 (I've tried 6.0.2800.1106).
Anyone got any thoughts?

Thanks
Andrew Cowper

I can't help much, but, yes, I've seen this frequently in cases where
wide to narrow character conversion was involved.

In my quick test (also IE6),

<meta http-equiv='content-type' content='text/html;charset=UTF-8'>
<!-- meta http-equiv='content-type'
content='text/html;charset=ISO-8859-1' -->
<script type='text/javascript'>
function test(){
var b = "?"=="";
alert('b: ' + b);
}
</script>

<a href='#a1' name='a1' id='a1' onclick='test(); return
false;'>test</a>

displays 'true' with UTF-8 but false with ISO-8859-1.

I suppose it's a question of how the == operator code in a given
browser compares a lower ASCII char to a wide char (not sure how many
bytes UTF-8 needs for '¦'). I suppose a conversion of the wide char to
a question mark might be intended to convey 'dunno what to make of
this'.

Not an expert. FWIW.
Jul 20 '05 #4
gd*******@hotmail.com (Greg) writes:
Andrew Cowper <ju*******@bloat.plus.com> wrote in
message news:<87************@bloat.plus.com>...
Anyone come across anything like this before? This is some javascript
validation of user input.

if ("?"=="¦") { alert("Holy Smoke!"); }
displays 'true' with UTF-8 but false with ISO-8859-1.


Yes, we are serving our pages as UTF-8 so this fits. I think I'm just
going to forget about testing for that character. Thanks Greg (and
others) for your help...

Andrew Cowper

--
Pick a different user name to email me.
Jul 20 '05 #5

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

Similar topics

0
by: Matthew Alton | last post by:
The appended program freaks python 2.2 & 2.3 completely out. To reproduce the wierdness: i) copy the source to a file called consarn.py ii) $ python consarn.py; iii) the program is now doing a...
13
by: Tek Boy | last post by:
I've been experiencing some (reproducable) wierdness when I try to generate some very basic HTML using ASP. Check out the following (basic) ASP code: ===========================================...
0
by: amber | last post by:
Hello, I'm having some wierdness with a report I've created in VB.NET (with Crysal Reports). The report is called repCPDocSubmissionSummary.vb I created it a while ago, and have been using it...
11
by: Mark A | last post by:
Here is Mark Townsend's (Oracle Product Manager) explanation and justification for posting in the DB2 newsgroup, as posted on the Oracle newsgroup, and my response: "Mark Townsend"...
5
by: Eduardo Olivarez | last post by:
The following code does not work correctly on my machine. Either one of the scanf()'s alone work perfectly. However, when they are combined, the second scanf() call just reads what the first one...
3
by: DraguVaso | last post by:
Hi, I have different VB.NET-applications that threat records from my table. To be sure a record isn't threated by two applications at the same time, I want to leave a mark in the record on the...
8
by: p175 | last post by:
Express C v9.1 I'm having a hell of a job trying to reduce the highwater mark for various tablespaces in Express C. DB2MART advises to reorg several tables with LONGLOBDATA and to disconnect,...
4
by: maria | last post by:
I only use C++ with Visual Studio 6.0 for string manipulations in thousands of HTML pages on my website. Many times, the output files of many of my C++ programs contain a spanish question mark (¿)...
9
by: Bobby Edward | last post by:
Are there any add-ons to Visual Studio 2008 that will help me troubleshoot CSS wierdness? Like showing the padding/margin with difference colors, etc...? I'm trying to figure out some wierd...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...

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.