Encoding Problem

2 posts, 1 answers
  1. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 31 May 2014 Link to this post

    Hi,

    we have an encoding problem in a autocompletenbox. As you can see on the attached file all "ä", "ü", "ö", "ß", are something like
    a "?". We bind a txt-file to the autocompletebox.
    using (StreamReader reader = new StreamReader(file, System.Text.Encoding.UTF8))
    {
        string line;
        Int32 i = 0;
        while ((line = reader.ReadLine()) != null)
        {
            i++;
            string[] tmp = line.Split(';');
            vartab.Add(new Vartab(tmp[1], tmp[0], i));
        }
    }

    How can we solve this problem?

    Thanks a lot
    Best Regrads from Austria
    Rene
  2. Answer
    Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 03 Jun 2014 Link to this post

    Hello Rene,

    Thank you for contacting us. I've tested the mentioned scenario and everything works fine on my side when the text file is encoded with UTF8. If the file is using some other encoding, the UTF8 that's used in the StreamReader's constructor will not be able to read all symbols correctly. Could you check if your file is using UTF8 encoding?

    I'm sending you my test project and the test file - as you can see the symbols are shown correctly when you search inside RadAutoCompleteBox's items.

    I'm looking forward to hearing from you.

    Regards,
    Rosen Vladimirov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top