0

I am using .net 4.5.2 c# wpf application and mandrill email serving api

Their api results so bad and need to manually fix character errors

So far I did these 2 things but still errors happens that drives me nuts

string srLoginCity = HttpUtility.HtmlEncode(myPerEmail.srLoginCity);
string srRegisterCity = HttpUtility.HtmlEncode(myPerEmail.srRegisterCity);

srLoginCity = RemoveDiacritics(srLoginCity);
srRegisterCity = RemoveDiacritics(srRegisterCity);

Even though both HtmlEncode and RemoveDiacritics latest error happened like below

The city name was : Diyarbakır

Their api thrown 500 internal server error with no description

Diyarbakır is still result as Diyarbakır after both process

So what else I need to do in order to convert it correctly so mandrill api which takes json data will not fail ?

I believe I either need to convert ı letter to i or encode it somehow.

There can be other letters which would fail so I don't want manual ı to i solution.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Furkan Gözükara
  • 22,964
  • 77
  • 205
  • 342
  • If you're trying to convert non-ascii Unicode characters to their "most similar" ASCII equivalent, that's not so easy. See maybe http://stackoverflow.com/questions/2624646/convert-unicode-char-to-closest-most-similar-char-in-ascii-net or http://stackoverflow.com/questions/3403877/find-similar-ascii-character-in-unicode. – dbc May 23 '15 at 16:33
  • Or, to escape non-ASCII characters, see here: https://stackoverflow.com/questions/1615559/converting-unicode-strings-to-escaped-ascii-string – dbc May 23 '15 at 16:49
  • @dbc ty for answer yes i can escape them but if browser renders them as escaped that would not work for me i suppose :D – Furkan Gözükara May 24 '15 at 00:53
  • @dbc yep i just tried browser does not render properly. it is – Furkan Gözükara May 24 '15 at 00:59

0 Answers0