473,796 Members | 2,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Translate accented characters

Is there anything in the framework which will help translate accented
characters in strings to their standard counterparts?

eg. "Gráda" to "Grada"
Nov 17 '05 #1
9 7841
"JezB" <je***********@ blueyonder.co.u k> wrote in message
news:uQ******** ******@TK2MSFTN GP14.phx.gbl...
Is there anything in the framework which will help translate accented
characters in strings to their standard counterparts?

eg. "Gráda" to "Grada"


Interestingly enough, I was looking for exactly the same thing recently, and
was unable to find anything native to the Framework, so I ended up writing
my own mapping function. Easy enough for the Latin languages (e.g. French,
Spanish, Italian, Portuguese etc), fairly simply for German (e.g. any vowel
with an umlaut is replaced by the unmodified vowel + 'e'), a little messier
for the Scandinavian languages, even worse for Greek and Cyrillic, and
almost impossible for the Eastern European languages with diacritics.

What is the business purpose behind your need to do this, AAMOI?
Nov 17 '05 #2
I'm passing artist/album names stored within mp3 files through Amazon's web
service, to look up album details. Many of the artist names have accented
characters, since I am interested in world/celtic music, but Amazon's serach
criteria seems to be based on normalized unaccented strings. A real pain to
edit all my id3 tags !

"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:Od******** ******@TK2MSFTN GP12.phx.gbl...
"JezB" <je***********@ blueyonder.co.u k> wrote in message
news:uQ******** ******@TK2MSFTN GP14.phx.gbl...
Is there anything in the framework which will help translate accented
characters in strings to their standard counterparts?

eg. "Gráda" to "Grada"


Interestingly enough, I was looking for exactly the same thing recently,
and was unable to find anything native to the Framework, so I ended up
writing my own mapping function. Easy enough for the Latin languages (e.g.
French, Spanish, Italian, Portuguese etc), fairly simply for German (e.g.
any vowel with an umlaut is replaced by the unmodified vowel + 'e'), a
little messier for the Scandinavian languages, even worse for Greek and
Cyrillic, and almost impossible for the Eastern European languages with
diacritics.

What is the business purpose behind your need to do this, AAMOI?

Nov 17 '05 #3
Hi,

There is nothing like this in the framework, what you can do is use
String.Replace , it will be slower but there are only 5 vocals after all :)

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"JezB" <je***********@ blueyonder.co.u k> wrote in message
news:uQ******** ******@TK2MSFTN GP14.phx.gbl...
Is there anything in the framework which will help translate accented
characters in strings to their standard counterparts?

eg. "Gráda" to "Grada"

Nov 17 '05 #4
Hi Jez,

There is nothing pre-made in .Net that will do what you want. You need to create a translation table and translate each character as necessary.

There is a method that seems to work in most cases involving translation between different encodings, but I cannot guarantee that it works in all cases.

string s = "áàäãâåéèëêíìïî óòöõôøúùüûýÿ";
byte[] b = Encoding.GetEnc oding(1251).Get Bytes(s);
string t = Encoding.ASCII. GetString(b);

//t == aaaaaaeeeeiiiio ooooouuuuyy
--
Happy coding!
Morten Wennevik [C# MVP]
Nov 17 '05 #5
"Morten Wennevik" <Mo************ @hotmail.com> wrote in message
news:op.sqif0dt 2klbvpo@stone.. .
There is a method that seems to work in most cases involving translation
between different encodings, but I cannot guarantee that it works in all
cases.

string s = "áàäãâåéèëêíìïî óòöõôøúùüûýÿ";
byte[] b = Encoding.GetEnc oding(1251).Get Bytes(s);
string t = Encoding.ASCII. GetString(b);

//t == aaaaaaeeeeiiiio ooooouuuuyy


No use at all for German:

ä = ae
ö = oe
ü = ue
ß = ss
Nov 17 '05 #6
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
in message news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
There is nothing like this in the framework, what you can do is use
String.Replace , it will be slower but there are only 5 vocals after all
:)


If by "vocals" you mean "vowels", then that just isn't the case in many
languages...
Nov 17 '05 #7
"JezB" <je***********@ blueyonder.co.u k> wrote in message
news:Ow******** ******@TK2MSFTN GP10.phx.gbl...
I'm passing artist/album names stored within mp3 files through Amazon's
web service, to look up album details. Many of the artist names have
accented characters, since I am interested in world/celtic music, but
Amazon's serach criteria seems to be based on normalized unaccented
strings. A real pain to edit all my id3 tags !


Then the translation table approach is what you need here...
Nov 17 '05 #8
That's good enough for me !!! This is just a hobby program so doesn't need
to be foolproof.
Many thanks Morten

"Morten Wennevik" <Mo************ @hotmail.com> wrote in message
news:op.sqif0dt 2klbvpo@stone.. .
Hi Jez,

There is nothing pre-made in .Net that will do what you want. You need to
create a translation table and translate each character as necessary.

There is a method that seems to work in most cases involving translation
between different encodings, but I cannot guarantee that it works in all
cases.

string s = "áàäãâåéèëêíìïî óòöõôøúùüûýÿ";
byte[] b = Encoding.GetEnc oding(1251).Get Bytes(s);
string t = Encoding.ASCII. GetString(b);

//t == aaaaaaeeeeiiiio ooooouuuuyy
--
Happy coding!
Morten Wennevik [C# MVP]

Nov 17 '05 #9
Hi,

Yes I meant vowels :)

It was an "spanglish" vocales = vowels in spanish :)
You are right, but in a particular language there are not that many, most
certainly by the description of the OP he has the mp3 tags in one language

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us >
wrote in message news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
There is nothing like this in the framework, what you can do is use
String.Replace , it will be slower but there are only 5 vocals after all
:)


If by "vocals" you mean "vowels", then that just isn't the case in many
languages...

Nov 17 '05 #10

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

Similar topics

1
3843
by: Bernhard Georg Enders | last post by:
I'm using the php 'file' command to read the contents of an ASCII text file to a variable. The original text file contains some accented and special characters. The problem arises when I echo this variable: the accented characters are messed up. And not only accented characters, for example, the special characters ª is printed as ª. What can I do to correct this issue? I have tried, without success, to use the 'setlocale' command. TIA,
1
2454
by: Fuzzyman | last post by:
I've written an anagram finder that produces anagrams from a dictionary of words. The user can load their own dictionary. ( http://www.voidspace.org.uk/atlantibots/nanagram.html ) In order to ensure it is able to find anagrams properly I wanted to strip characters like punctuation etc from words in the dictionary and words the user entered. I test(ed) against the 26 English letters ( string.ascii_lowercase ).
14
16127
by: Nicolas Bouillon | last post by:
Hi I would like to replace accentuel chars (like "é", "è" or "à") with non accetued ones ("é" -> "e", "è" -> "e", "à" -> "a"). I have tried string.replace method, but it seems dislike non ascii chars... Can you help me please ? Thanks.
2
2662
by: Remco van den Berg | last post by:
I'm running a MySQL database with one of tables holding the members of a volleybal club in the Netherlands. One the the fields in that table is holding the name of the players. How do I search for all people with the name "Andre", with the important remark, that it should also match "André"!! So with the letter "e" with an accent "'" on it. In the Netherlands those names can be spelled with and without the accent and I do not always...
2
1706
by: nicolas_riesch | last post by:
I try to use python as the language in an asp page with Microsoft IIS 5.0. I have these two files, req_bad.asp and req_ok.asp ---------- req_bad.asp --------- <%@LANGUAGE=Python%> <%
4
2031
by: Satish | last post by:
Hi Gurus, Please help me in this, I have tried all options available to me. (Option 1) I am making a simple request from VB.NET client to WBI generated WSDL and passing request parameters. The response I am expecting should have some accented characters (Customer Name: Lokalcenter Åbygård), but this gets truncated and response is as follows (Customer Name: Lokalcenter bygrd). The WSDL has utf-8 character set defined.
0
2307
by: shintu | last post by:
Hallo, I am trying to write french accented characters é è ê in Excel worksheet using my perl script , But I am stuck here as I couldnt find a way of writing it !: My code: use strict; use warnings;
2
6432
by: gsuns82 | last post by:
Hi all, I have to replace accented characters from a input string with normal plain text.I have coded as follows. String input = "ÄÀÁÂÃ"; input= input.replaceAll("", "A"); like wise v can do for all. output was: ************ AAAAA
4
2898
by: gsuns82 | last post by:
Hi all, I am facing a strange issue. i.e: I have a jsp page with an input text field where the user can enter searching value even along with Accented Characters.After that i am getting the input value at the controller inorder to compose a query,before that i am replacing Accented Characters with plain text values so that i can append the proper input value in the DBquery. I tried to replace the input string for ...
0
9680
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
10228
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
10173
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
9052
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
7547
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...
0
6788
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
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2925
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.