开发者

regiona setting Encoding problems

I have a config file in xml format for my applications. The xml file strats with

<?xml version="1.0" encoding="UTF-8" ?>

In this file I have a setting that contains "i" character (73 ASCII code). If I change my regional setting to Turkish and location to Turke开发者_开发百科y then when I get the setting from the config file the character does not have 73 ASCII code anymore, it has 196 176. How can I convert the settign so I can get to "i" with 73 ascii code not the 196 176 one. Thank you, Bogdan

here is some code..

XmlDocument doc = new XmlDocument();
doc.Load(configFilePath);
....
node = perentNode.SelectNodes("MySetting");
string mysetting = node[0].InnerText;


I fixed the problem doing

var oldSetting = Application.CurrentCulture; Application.CurrentCulture = CultureInfo.InvariantCulture;
..myjob Application.CurrentCulture = oldSetting;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜