简体   繁体   English

使用数据集读取值会弄乱取决于客户端操作系统的特定语言字符

[英]Reading values with dataset messes up specific language characters dependending on client OS

I have made a windows application using C# that creates a dataset with data from a Dbase database file using a OleDBConnection. 我使用C#制作了一个Windows应用程序,该应用程序使用OleDBConnection从Dbase数据库文件中创建数据来创建数据集。

My problem is that this runs just fine on my own computer (swedish) but when i run this on my server (english) the swedish letters (å,ä,ö,Å,Ä,Ö) gets messed up. 我的问题是,这在我自己的计算机(瑞典语)上运行得很好,但是当我在服务器(英语)上运行它时,瑞典字母(å,ä,ö,Å,Ä,Ö)被弄乱了。

I have tried this with no luck: 我没有运气尝试过这个:

System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("sv-SE");
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("sv-SE");

Ok well so i kinda fixed it myself, not the best of ways but it will work for me. 好的,所以我可以自己修复它,虽然不是最好的方法,但是它对我有用。

Since i will be running if on a English OS computer i made function that changed all the weird characters to swedish ones. 因为如果在英语操作系统的计算机上运行,​​我将把所有奇怪的字符都更改为瑞典语的功能。

public string changeSpecialCharacters(string kund)
{
    StringBuilder b = new StringBuilder(kund);

    b = b.Replace("σ", "å");
    b = b.Replace("┼", "Å");
    b = b.Replace("Σ", "ä");
    b = b.Replace("─", "Ä");
    b = b.Replace("÷", "ö");
    b = b.Replace("╓", "Ö");

    return b.ToString();
}

Until i find a way to do this differently ill stick with it. 直到我找到一种方法来解决这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM