473,785 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Firefox: Filter Extended Ascii from Form

My appologies if this ends up being a duplicate post. For some reason the
first post never showed up.

I've tried about 300 iterrations of this same ability, and none of them seem
to work in Firefox. Take the following code for example. It WILL stop me
from entering zero into the first text box, but it wont stop me from
entering extended ascii characters (which is the final goal).

Two items of note:
1) Typing ALT+0156 inputs "o". And strangely enough the statusbar text gets
set to "ALT0moz2 ALT0moz2 ALT0moz2". Only 3 ALT sequences show up when I
actually type 4 characters
2)Im working on a laptop that has no true numpad, so the '0' may be a result
of me having to hold down a special function key in order to enable a numpad
overlay.). So the check for altKey is correctly working, but attempting to
cancel the ALT event fails.

Does anyone know what is wrong with this, or have a working example that
stops ALT keypresses / Extended chars in FIREFOX ?
<script type="text/javascript">
if(document.add EventListener){
document.addEve ntListener("key press", HandleEnterKey, true);
}
else{
document.attach Event("onkeypre ss", HandleEnterKey) ;
}
// Handle the enter key for a section of a form, binding it to the provided
submit buton
function HandleEnterKey( event) {
var nav = window.Event ? true : false;
if (nav) {
return NetscapeEventHa ndler_KeyDown(e vent);
} else {
return MicrosoftEventH andler_KeyDown( );
}
}

function NetscapeEventHa ndler_KeyDown(e ) {
if (e.which == 48) {
window.status = window.status + e.which + "moz1 ";
e.returnValue = false;
e.cancel = true;
e.preventDefaul t();
return false;
} else if (e.altKey) {
window.status = window.status + "ALT" + e.which + "moz2 ";
e.returnValue = false;
e.cancel = true;
e.stopPropagati on();
e.preventDefaul t();
return false;
}
return true;
}
</script>
</head>
<body>
<form action="" id="theForm">
<input type="text" id="i1" name="i1" />
</form>
Sep 17 '05 #1
13 7778
bgbauer70 wrote:
[...]

// Handle the enter key for a section of a form, binding it to the provided
submit buton
function HandleEnterKey( event) {
var nav = window.Event ? true : false;
if (nav) {
return NetscapeEventHa ndler_KeyDown(e vent);
} else {
return MicrosoftEventH andler_KeyDown( );
}
}


I don't have a solution, but the following is possibly a better way to
determine appropriate the event model:

function HandleEnterKey( e ) {
if ( e ) {
return NetscapeEventHa ndler_KeyDown( e );
} else if ( window.event ) {
return MicrosoftEventH andler_KeyDown( );
}
}

If you are trying to restrict the characters that can be entered into a
text input, you are probably better off to use a regular expression to
test its value rather than trying to intercept keystrokes.

For example, I can enter a zero into the text input by copying and
pasting - ctrl+v or Edit->Paste - without using the zero key.

[...]

--
Rob
Sep 18 '05 #2
Hi Rob,

Is there a way to regex test based on ascii #? The problem is I just want
to filter out high ascii ( >127 ).
"RobG" <rg***@iinet.ne t.au> wrote in message
news:43******** *************** @per-qv1-newsreader-01.iinet.net.au ...
bgbauer70 wrote:
[...]

// Handle the enter key for a section of a form, binding it to the
provided
submit buton
function HandleEnterKey( event) {
var nav = window.Event ? true : false;
if (nav) {
return NetscapeEventHa ndler_KeyDown(e vent);
} else {
return MicrosoftEventH andler_KeyDown( );
}
}


I don't have a solution, but the following is possibly a better way to
determine appropriate the event model:

function HandleEnterKey( e ) {
if ( e ) {
return NetscapeEventHa ndler_KeyDown( e );
} else if ( window.event ) {
return MicrosoftEventH andler_KeyDown( );
}
}

If you are trying to restrict the characters that can be entered into a
text input, you are probably better off to use a regular expression to
test its value rather than trying to intercept keystrokes.

For example, I can enter a zero into the text input by copying and
pasting - ctrl+v or Edit->Paste - without using the zero key.

[...]

--
Rob

Sep 18 '05 #3
bgbauer70 wrote:
Is there a way to regex test based on ascii #? The problem is I just want
to filter out high ascii ( >127 ).


A string method:
String.charCode At(index)
Returns the decimal Unicode value, but for most characters it's the same
as AASCI.
Mick
Sep 18 '05 #4
bgbauer70 wrote:
Hi Rob,

Is there a way to regex test based on ascii #? The problem is I just want
to filter out high ascii ( >127 ).


There is no such thing as "high ascii" - it stops at 127, there are no
ASCII characters beyond it. As Mick suggests, you could use the Unicode
value to discriminate or you could make a regular expression that tests
for the 95 displayable ASCII characters. I think the former is simpler.

There is a relevant thread here in c.i.a.html:

<URL:http://groups.google.c o.uk/group/comp.infosystem s.www.authoring .html/browse_frm/thread/aa2508a3174597d 5/9d5f6ded0144e4c 8?q=high-ascii+character &rnum=1&hl=en#9 d5f6ded0144e4c8 >

An an excellent piece on HTML character encoding here:

<URL:http://ppewww.ph.gla.a c.uk/~flavell/charset/checklist>
[...]
--
Rob
Sep 18 '05 #5

"RobG" <rg***@iinet.ne t.au> wrote in message
news:1m******** *********@news. optus.net.au...
bgbauer70 wrote:
Hi Rob,

Is there a way to regex test based on ascii #? The problem is I just
want to filter out high ascii ( >127 ).


There is no such thing as "high ascii" - it stops at 127, there are no
ASCII characters beyond it.


This is just not true. The extended ASCII character set has 255.
Sep 19 '05 #6
ASM
bgbauer70 wrote:
"RobG" <rg***@iinet.ne t.au> wrote in message
news:1m******** *********@news. optus.net.au...
bgbauer70 wrote:
Hi Rob,

Is there a way to regex test based on ascii #? The problem is I just
want to filter out high ascii ( >127 ).


There is no such thing as "high ascii" - it stops at 127, there are no
ASCII characters beyond it.

This is just not true. The extended ASCII character set has 255.


here(*) :
http://www.miakinen.net/vrac/c08/charsets
I see ASCII with 126 carateres
and (extended ASCII ?) charset : CP437
with 255 caracteres

(*) use alternative css 'Tableaux en pixels'
--
Stephane Moriaux et son [moins] vieux Mac
Sep 19 '05 #7
To filter out, you could perhaps filter out from >126 as 127 is unused.

The reg exp woud be:-

var r=/[\x7F-\xFF]*/g;
s=s.replace(r," ");

Sep 19 '05 #8
Baconbutty wrote:
To filter out, you could perhaps filter out from >126 as 127 is unused.

The reg exp woud be:-

var r=/[\x7F-\xFF]*/g;
s=s.replace(r," ");

Good, but this replaces control characters too (\x0 - \x1f )
Mick
Sep 19 '05 #9
bgbauer70 wrote:
"RobG" <rg***@iinet.ne t.au> wrote in message
news:1m******** *********@news. optus.net.au...
bgbauer70 wrote:
Hi Rob,

Is there a way to regex test based on ascii #? The problem is I just
want to filter out high ascii ( >127 ).

There is no such thing as "high ascii" - it stops at 127, there are no
ASCII characters beyond it.

This is just not true. The extended ASCII character set has 255.


There are a vast array of extended ASCII sets, IBM alone developed over
three hundred of them[1], but none of them are standards. The following
reference seems a pretty good history:

<URL: http://en.wikipedia.org/wiki/ASCII >

ASCII consists of 128 characters mapped to a decimal range of 0 to 127
inclusive. Because it's been around for over 40 years, it's been
bastardised many times but:

"...most widely-used form uses the ANSI X3.4-1986 definition, also
standardized as ECMA-6, ISO/IEC 646:1991 International Reference
Version, ITU-T Recommendation T.50 (09/92), and Request for Comments
RFC 20."

In other words, the ASCII 7 bit character set has been standardised by a
number of official international standards-setting organisations[2].

I'm happy to be proven wrong, but you'll need to find a reference to an
official standard for 'the extended ASCII character set' to do it.
1.
<URL:
http://www-03.ibm.com/servers/eserve...codepages.html


2.
Standard ECMA-6:
<URL:
http://www.ecma-international.org/pu...T/Ecma-006.pdf >

--
Rob
Sep 19 '05 #10

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

Similar topics

4
3852
by: wob | last post by:
Many thanks for those who responded to my question of "putting greek char into C string". In searching for an solution, I noticed that there are more than one version of "Extended ASCII characters"(No. 128 to 255) . e.g., in one version No. 224 is the symbol alpha, in another, it's a "a" with a ` on it... How come? You can see it here: http://www.kturby.com/cables/ascii2.htm
3
24528
by: JSM | last post by:
Hi, I am just trying to port an existing simple encryption routine to C#. this routine simply adds/substracts 10 ascii characters to each character in a text file (except quotes). The routine for decrypting the file works fine however when I encrypt the file, several characters are corrupted. when I looked into it they are always extended ascii characters (eg "x" which is ascii character 120 gets translated to ascii character 130 which...
6
14464
by: Mark Olbert | last post by:
The doPostBack javascript functioning is not submitting the page when called by linkbuttons (or an autopostback checkbox, for that matter). I'm aware of a problem with Netscape browsers and the postback code, but I have a workaround for that installed (and it looks like the code generated by ASP.NET when it renders the page does the same thing, namely, setting document<). However, the problem still exists under firefox. Has anyone come...
4
7236
by: =?Utf-8?B?Um9zaGFuIFIuRA==?= | last post by:
Hi All, I am new to C# programming; I am developing an application for recording audio data using voice modem. I am using HyperTerminal to manually process audio data. The modem when configured in voice record mode sends the audio (PCM) data on the serial port, few of the characters from these are in Extended ASCII range i.e. more than 127 decimal. In HyperTerminal we can reset the property to force the incoming data to 7 bit ASCII,...
13
48087
by: ramif | last post by:
Is there a way to print extended ASCII in C?? I tried to code something, but it only displays strange symbols. here is my code: main() { char chr = 177; //stores the extended ASCII of a symbol printf("Character with an ascii code of 177: %c \n", chr); //tries to print an ASCII symbol...
5
4020
by: DAHMB | last post by:
Hi all, Using Access 2007 I have a report called Sunday School Attendance based on a Query called qryAttendance the query is as follows: SELECT tblSundaySchoolAttendance.StudentID, tblSundaySchoolAttendance.AttendanceDate, . FROM tblSundaySchoolAttendance INNER JOIN ON tblSundaySchoolAttendance.StudentID=.StudentID;
5
3685
by: Jim Mandala | last post by:
Using Access 2003 front end; SQL Server 2005 Back end: I have a complex form that has lots of data fields including about thirty or so checkboxes storing Yes/No data that I would like my users to be able to use the Filter by Form functionality with to create a "Custom" query. This works perfectly fine when I filter on a text field. Also, this works perfectly fine for all data with an Access Back end. When I use boolean data and my SQL...
1
4223
by: littlealex | last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS! In IE6 the text for the following page doesn't display properly - rather than being aligned to the top, along with the slideshow and link buttons, you have to scroll down to see the text - how can I make IE6 display correctly? http://geekarama.co.uk/new_home.html here is the code for new_home.html and following that the CSS...
0
9645
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
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10329
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
10152
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...
1
10092
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8974
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...
1
7500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2880
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.