locked
Visual Studio 11 F# Editor Encoding issue RRS feed

  • Question

  • Hello
    I have different results with code below:
    [VS2011]
    printfn "%O" <| System.Char.Parse("\u041F")  // > П   
    System.Char.Parse("\u041F")                          // > val it : char = '�'  -- fail
    
    [VS2010]
    printfn "%O" <| System.Char.Parse("\u041F")  // > П   
    System.Char.Parse("\u041F")                          // > val it : char = 'П'  -- ok

    It's looks like a bug in VS11, is it?
    P.S.
    \u041F - one of the Cyrillic chars defined in Unicode http://unicode.org/charts/PDF/U0400.pdf


    UPDATE#1

    Code in console works fine, but fails in F# Interactive. Errors are highlighted.

     

     

     

    • Edited by Malobukv Tuesday, September 27, 2011 6:05 PM UPDATE#1
    Monday, September 26, 2011 8:13 PM

Answers

  • Unfortunately I don't think there is a workaround. This is an artifact of the way we and .NET wrap and encode/decode the stuff coming from/going to the FSI command line process for displaying in the Visual Studio FSI window. If your code goes through the whole redirection process (as when you use printfn) then you get the right result, but otherwise you're stuck with that bad behavior :(

    On the plus side we've been able to fix it for the next release.

    Friday, September 30, 2011 12:34 AM

All replies

  • Works fine for me both in VS10 and VS11 (F# 3.0 build 4.0.30319.16909). Maybe it depends on some system settings.
    Petr
    Monday, September 26, 2011 9:43 PM
  • I'm trying to understand which settings influence the F# Interactive.

    I have Windows 7 Ultimate, english version.
    Sysinternal Provess Explorer shows the following of Fsi.exe propeties - image:
    "C:\Program Files\Microsoft SDKs\F#\3.0\Framework\v4.0\fsi.exe" --fsi-server-output-codepage:65001 --fsi-server-input-codepage:65001 --fsi-server-lcid:1033 --fsi-server:FSIChannel_6740_763069328_884777565 --optimize

    How can I change the Fsi settings after loading? Do I need to change them?

     

    Tuesday, September 27, 2011 2:02 PM
  • I run VS11 on Windows 8 dev preview (x86) all works fine in the default installation
    Petr
    Tuesday, September 27, 2011 3:04 PM
  • Thank you, I will keep in mind, but I'm trying to use Visual Studio 11 F# interactive on Windows 7.
    Could anyone help clarify encoding issue?
    Tuesday, September 27, 2011 3:29 PM
  • I don't have a machine with the developer preview immediately available but I can verify the behavior in our current bits is the same as VS2010. It's entirely possible we've fixed a bug relevant to this since the build we used for the dev preview:

     

    > printfn "%O" <| System.Char.Parse("\u041F");;

    П

    val it : unit = ()

    > System.Char.Parse("\u041F");;

    val it : char = 'П'

    >

    Tuesday, September 27, 2011 10:12 PM
  • I know the bug was fixed in development branch after my bug report. Is there any workaround before fix will appear in the next release?
    • Edited by Malobukv Thursday, September 29, 2011 10:38 AM link to my bug report
    Wednesday, September 28, 2011 8:49 AM
  • Unfortunately I don't think there is a workaround. This is an artifact of the way we and .NET wrap and encode/decode the stuff coming from/going to the FSI command line process for displaying in the Visual Studio FSI window. If your code goes through the whole redirection process (as when you use printfn) then you get the right result, but otherwise you're stuck with that bad behavior :(

    On the plus side we've been able to fix it for the next release.

    Friday, September 30, 2011 12:34 AM