By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,028 Members | 1,051 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,028 IT Pros & Developers. It's quick & easy.

Replacing international characters

P: n/a
Hi,

I am working on a project where I need to convert international characters
with acii values. Like Andr -> andre and Bjrn -> bjorn.

How can I do this without replacing every single character?

lastname = lastname.Replace("", "a");
lastname = lastname.Replace("", "e");
lastname = lastname.Replace("", "o");
....

Alain

May 2 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You could probably do something like normalise the string to Unicode
normalisation form D (so for example '' would map to 2 characters, 'a'
without macron followed by a combining macron character) then remove any
combining characters by a regex replacing "\p{Lm}" with an empty string (Lm
is a Unicode category containing modifier characters such as accents - this
may or may not correspond to the class of accents etc. you need to remove),
though there may be better ways I'm not aware of.

See for example

http://msdn.microsoft.com/library/de...ize_string.asp

for the string normalisation API - there are links to topics on
normalisation.

--
======================
Clive Dixon
Digita Ltd. (www.digita.com)
"Alain" <al***@nospam.com> wrote in message
news:4e**************************@news.microsoft.c om...
Hi,

I am working on a project where I need to convert international characters
with acii values. Like Andr -> andre and Bjrn -> bjorn.

How can I do this without replacing every single character?

lastname = lastname.Replace("", "a");
lastname = lastname.Replace("", "e");
lastname = lastname.Replace("", "o");
...

Alain

May 2 '06 #2

P: n/a
Actually, it looks like they've included normalisation in .NET 2.0 string
class:

http://msdn2.microsoft.com/en-us/library/ebza6ck1.aspx

--
======================
Clive Dixon
Digita Ltd. (www.digita.com)
"Alain" <al***@nospam.com> wrote in message
news:4e**************************@news.microsoft.c om...
Hi,

I am working on a project where I need to convert international characters
with acii values. Like Andr -> andre and Bjrn -> bjorn.

How can I do this without replacing every single character?

lastname = lastname.Replace("", "a");
lastname = lastname.Replace("", "e");
lastname = lastname.Replace("", "o");
...

Alain

May 2 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.