Hi!

I'd like to reevaluate nim for very small tasks. I have here a Windows 10 with 
these compilers:
    
    
    gcc --version
    gcc.exe (x86_64-win32-seh-rev1, Built by MinGW-W64 project) 6.3.0
    ...
    
    nim --version
    Nim Compiler Version 0.18.0 [Windows: amd64]
    ...

I try to print out Umlauts on the shell, or in the terminal in Visual Studio 
Code (I use the Visual Studio Code nim extension and press there f6...) But I 
don't get it. I think I make somehow a mistake, and hope someone can tell me 
what it is (please don't say wrong Operating System)

I use this code here (It's in an UTF-8 file, as far my Editor tells me): 
    
    
    import "encodings"
    
    let currentEncoding = getCurrentEncoding()
    
    # ala docs: proc open(destEncoding = "UTF-8"; srcEncoding = "CP1252"): 
EncodingConverter {..}
    # so as first parameter comes the destination (that should be the current 
encoding, right?)
    # and the source - the second parameter - should be UTF-8, because this 
source-code sit's in an UTF-8 file.
    let enc = encodings.open(currentEncoding, "UTF-8")
    
    let message = "This should be an umlaut O: Ö"
    
    echo "Current Encoding: ", currentEncoding
    echo message
    echo enc.convert(message)
    
    
    Run

Unfortunately it spits out:
    
    
    Current Encoding: windows-1252
    This should be an umlaut O: Ö
    This should be an umlaut O: Í

I expected the last echo to print out an Ö at the end.

Funny thing, if I save that as Windows 1252 it spits out This should be an 
umlaut O: Í

Can anyone guide me a bit please? Thank you, Gregor

Reply via email to