1

I have a string variable that stores a text in Turkish language

string str = "açğş";

I want to convert each character of this string to appropriate English Letter.

So that the conversion must be like: , açğş --> acgs

How can I do it using .NET/C# ?

Teoman Soygul
  • 25,584
  • 6
  • 69
  • 80
Ahmet Altun
  • 3,910
  • 9
  • 39
  • 64
  • Maybe this will help you : http://stackoverflow.com/questions/2621275/regular-expression-to-validate-name-in-net-multilingual-web-application –  Jul 15 '11 at 19:45
  • 6
    I personally like the one that [StackOverflow](http://meta.stackexchange.com/questions/7435/non-us-ascii-characters-dropped-from-full-profile-url/7696#7696) uses to convert characters. – Brad Christie Jul 15 '11 at 19:47

4 Answers4

0
string[] notAccpetedA = new string[] {"ã","ä"};
string mystring = "ãçğş";
foreach(string _char in notAcceptedA)
{
mystring.Replace(_char,"a");
}
rlemon
  • 17,518
  • 14
  • 92
  • 123
0

Easiest way: str = str.Replace("ç", "c").Replace("ğ", "g").Replace("Ç", "C")....;

0

From one of Jeff Atwood's original posts on URL purifying, they call RemapInternationalCharToAscii. please check that/those post(s) out, as I believe they are a great solution (and, given it's Jeff Atwood ♦ speed has been taken in to consideration).

Community
  • 1
  • 1
Brad Christie
  • 100,477
  • 16
  • 156
  • 200
0

1- use Dictionary<char,string> Dic= new Dictionary<char,string>();

2- populate the dictionary with Translation letters

3- strOut =String.Join("", StrIn.ToCharArray().Select(C=>Dic.ContainsKey(C)?Dic[C]:C.ToString()).ToArray());

Waleed A.K.
  • 1,596
  • 13
  • 13