简体   繁体   中英

How to write unicode to Visual Studio output tab for debugging (NOT console app)?

In my WPF app, when I attempt to use Console.WriteLine for debugging purposes, I get a ? in the "Output" window when writing unicode characters.

Console.WriteLine("こんにちは!");
// Output: ?????!

The solution mentioned in many other threads does not seem to work with WPF

Console.OutputEncoding = Encoding.UTF8; // Crashes

Is it possible to get unicode to work in the output tab?

Technically there is no Console in WPF , however certain console commands seemingly do redirect to the output window . In short the Console is a special beast with its own set of limitation and quirks.

For debugging, use Debug.WriteLine to write to the output window instead.

Debug.WriteLine("こんにちは!");

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM