473,785 Members | 2,798 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 12464
"yearTiger2 002" <ha*****@yahoo. com> wrote in message
news:66******** *************** **@posting.goog le.com...
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="#0000f f" text="#ffffff" link="#00ffff" vlink="#00ffff" >

<FORM>
<TEXTAREA cols=30 rows=3 onblur='this.va lue=stripVowelA ccent(this.valu e)' wrap>
À Á Â à á â È É Ê è é ê
Ì Í Î ì í î Ò Ó Ô ò ó ô
Ù Ú Û ù ú û
</TEXTAREA>
</FORM>
<BR>
To strip accents, click on link or blur the text field.<BR><BR>
<A HREF='#'
onclick='docume nt.forms[0].elements[0].value=stripVow elAccent(docume nt.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 stripVowelAccen t(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(rEx ps[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
47821
by: Pikkel | last post by:
i'm looking for a way to replace special characters with characters without accents, cedilles, etc.
3
3551
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 seem to overcome, is that the english text font size my program thinks is available doesn't seem to be there. Although a line of text printed on a US Windows machine looks fine, when it is printed from this French computer the tabs are over written...
5
2852
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" value="Noël Pirès"/> <input type="submit" value="OK"/> </form>
3
30410
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 have a string consisting of: -- 3 spaces -- The characters "hello"
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 how can I possible modify my program so that french characters get recognised? Thanks in advance,
5
2443
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 to replace TAB's with "&nbsp;"'s to preserve the user's indentation. My questions are: 1) even though I'll probably look it up before I get a reply.... whats the vb code for TAB character? 2) more importantly; do I have to run this large field...
4
4369
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 thanks!
3
3504
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 read in msdn : and notice that trim only Removes all occurrences of white space characters from the beginning and end of this instance. So what for the middle ? .NET Framework Class Library
7
20311
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 obviously sent by PHP mail. everything seemed to be working when i text encoded the sent email with UTF-8... but then i tried it in Yahoo Mail, and i got those "?" symbols where french characters like "é" or "ç" were suppose to be... i've read up...
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...
1
10095
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
9953
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
6741
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
5383
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
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
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
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
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.