473,507 Members | 6,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

replace french characters in form input?

Our company's back end database server does not handle french
accentuated characters well. We need to replace those characters with
english letters when validating the form inputs. Any suggestions? I've
never delt with foreign languages before...any help greatly
apprieciated!
Jul 23 '05 #1
2 12441
"yearTiger2002" <ha*****@yahoo.com> wrote in message
news:66*************************@posting.google.co m...
Our company's back end database server does not handle french
accentuated characters well. We need to replace those characters with
english letters when validating the form inputs. Any suggestions? I've
never delt with foreign languages before...any help greatly
apprieciated!


It's a matter of scanning for accented character codes and replacing them
accordingly. This would be my solution, which will remove grave, acute and
circumflex accents from vowels.
<HTML>
<HEAD>
<title>Accent Stripper</title>
<STYLE>
body{font-size:1.2em}
</STYLE>
</HEAD>

<BODY bgcolor="#0000ff" text="#ffffff" link="#00ffff" vlink="#00ffff">

<FORM>
<TEXTAREA cols=30 rows=3 onblur='this.value=stripVowelAccent(this.value)' wrap>
À Á Â à á â È É Ê è é ê
Ì Í Î ì í î Ò Ó Ô ò ó ô
Ù Ú Û ù ú û
</TEXTAREA>
</FORM>
<BR>
To strip accents, click on link or blur the text field.<BR><BR>
<A HREF='#'
onclick='document.forms[0].elements[0].value=stripVowelAccent(document.forms[0].
elements[0].value);return false'>Strip Accents</A>

<SCRIPT type='text/javascript'>

/* (C)Stephen Chalmers
* Strips grave, acute & circumflex accents from vowels
*/

function stripVowelAccent(str)
{
var s=str;

var rExps=[ /[\xC0-\xC2]/g, /[\xE0-\xE2]/g,
/[\xC8-\xCA]/g, /[\xE8-\xEB]/g,
/[\xCC-\xCE]/g, /[\xEC-\xEE]/g,
/[\xD2-\xD4]/g, /[\xF2-\xF4]/g,
/[\xD9-\xDB]/g, /[\xF9-\xFB]/g ];

var repChar=['A','a','E','e','I','i','O','o','U','u'];

for(var i=0; i<rExps.length; i++)
s=s.replace(rExps[i],repChar[i]);

return s;
}

</SCRIPT>

</BODY>
</HTML>

--
Stephen Chalmers


Jul 23 '05 #2
It works like magic, thanks a million!

I was in the middle of a painful process of creating two long arrays for
both french characters and english ones.....you saved my day!


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3

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

Similar topics

17
47794
by: Pikkel | last post by:
i'm looking for a way to replace special characters with characters without accents, cedilles, etc.
3
3537
by: Salgoud Dell | last post by:
I have a VB6 application running on a French computer using Windows ME. The app doesn't work the same way as it does when running on an English Windows OS. The main issue I have, that I can't...
5
2827
by: darin dimitrov | last post by:
Hello, How can I convert an url encoded string containing some french characters back to the original string? I have the following html form: <form> name = <input type="text" name="name"...
3
30393
by: o_swas | last post by:
Hello, I have a JavaScript string. I want to replace all consecutive occurrences of whitespace characters like spaces, tabs, newlines, and form feeds with another string. For example, say I...
8
393
by: Ess355 | last post by:
Hi, In the debugger at run time, characters like é are not recognised by their normal ASCII number, but something like -8615722... . I've seen this number before, it means "rubbish" right? So...
5
2416
by: djc | last post by:
I need to prepare a large text database field to display in an asp.net repeater control. Currently I am replacing all chr(13)'s with a "<br/>" and it works fine. However, now I also want to be able...
4
4298
by: jgabbai | last post by:
Hi, What is the best way to white list a set of allowable characters using regex or replace? I understand it is safer to whitelist than to blacklist, but am not sure how to go about it. Many...
3
3489
by: Pascal | last post by:
bonjour hello I would like to trim a string of all its white spaces so i used myString.trim() but it doesn't work as supposed : unsecable space are remaining in the middle of my string... i...
7
20266
chunk1978
by: chunk1978 | last post by:
i though i had this under control, but i'm completely lost... i have a form which allows a user to fill out information, which is then emailed to myself as well as themselves... the form is...
0
7223
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
7110
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
7314
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
5623
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,...
1
5041
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...
0
3191
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...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1540
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 ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.