locked
[UWP]GetEncoding - 'windows-1252' is not a supported encoding name (Windows 10 universal prooject)

    Question

  • Hi.

    I have a trouble with System.Text.GetEncoding  windows-1252 at windows universal  prooject

            public MainPage()
            {
                this.InitializeComponent();
                Loaded += MainPage_Loaded;
            }
    
            private void MainPage_Loaded(object sender, RoutedEventArgs e)
            {
                var encoding = Encoding.GetEncoding("windows-1252");
            }

    Additional information: 'windows-1252' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.

    - VS 2015 RC- Win10 10074

    Monday, May 4, 2015 11:22 AM

Answers

  • I am afraid the framework subset for Windows Phone doesn't come with support for Windows-1252. You could use Latin-1 (ISO-8859-1) encoding and manually substituting the characters in the 129-159-range as suggested in the following thread or implement your own custom encoding: http://stackoverflow.com/questions/14110730/reading-windows-1252-encoding-in-windows-phone-8

    var encoding = Encoding.GetEncoding("latin1");

    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

    • Marked as answer by 646826 Monday, May 4, 2015 6:07 PM
    Monday, May 4, 2015 2:40 PM