Console App, StdOut.WriteLine: Encoding issue (How to output special chars, e.g. Umlaute?)

I’d like to move a couple of console apps from REAL Studio 2011r3 to a current Xojo version.
Since our apps are mostly in German, special chars such as Umlaute are important. Let’s just use my name: Jürg

  • REAL Studio 2011r3: No issues at all. All Strings (just by code / DOSLatin1 / UTF8) show properly in the output.
  • Xojo 2014r2.1: Only the String with DOSLatin1 shows properly.
  • Xojo 2015r4 - Xojo 2017r3: It doesn’t seem possible to get Umlaute in the output.

That’s reported and verified in January 2016 as <>.
Well, since it’s still not fixed… does anyone know a workaround? Somehow it has to be possible to write my first name in the Output of a Console App…?
How are others with “non english” apps writing to StdOut in Windows Console Apps? Are all using Xojo versions of 2014 or earlier?

You may want to try encodings.windowsLatin1

Nope, doesn’t work either:

stdout.WriteLine(ConvertEncoding("Umlaute: ö ä ü Ö Ä Ü é à è", Encodings.WindowsLatin1)) stdout.WriteLine(ConvertEncoding("Name: Jürg Otter", Encodings.WindowsLatin1))
results in:

Umlaute: ÷ õ ³ Í ? ? Ú Ó Þ Name: J³rg Otter

I would not use convertencoding.

Maybe you want to try

stdout.WriteLine(DefineEncoding("Umlaute: ö ä ü Ö Ä Ü é à è", Encodings.WindowsLatin1)) stdout.WriteLine(DefineEncoding("Name: Jürg Otter", Encodings.WindowsLatin1))

that results in:

Umlaute: ? ? ?? ?? ?? ?? ? ? ? Name: J??rg Otter
I’ve tried many combinations of Define/ConvertEncoding… without success. But I keep hoping that there is some way (which I have missed).

Something like this?

I get to see the same glibberish when run in cmd.exe

I’ve changed from the example in the other thread:

Dim bs As New BinaryStream(dup, BinaryStream.HandleTypeWin32Handle) bs.Write("Jürg Otter, ö ä ü") //tried with Convert/DefineEncoding here, too bs.Close

I’m able to print “Jürg” using the BinaryStream method I linked to earlier if I convert the String to Encodings.DOSLatin1.

Thanks! I guess I’ve just tried WindowsANSI, WindowsLatin1, … yesterday.
But you’re right - the methode from the linked thread with the change works to get the characters displayed.

Dim bs As New BinaryStream(dup, BinaryStream.HandleTypeWin32Handle) bs.Write(ConvertEncoding(psText + EndOfLine.Windows, Encodings.DOSLatin1)) bs.Close
Btw: Meanwhile <> has been fixed. I guess the this workaround will get a #if XojoVersion < 2018.02 :wink: