VisualStudio SP1 Environment
1. Set the string default encoding to UTF8, just add the following code to the file header
1 #pragma // use UTF8 by default
2, Debug Prompt window display UTF8, open C:\Program Files (x86) \microsoft Visual Studio 10.0\common7\packages\debugger\ Autoexp.dat file Find line No. 412 to No. 413, the original text is as follows:
1 std::basic_string<char,*>{2 preview #if ($e. _myres ) < ($e. _buf_size)) ([$e. _bx._buf,s]) #else ([$e. _bx._ptr,s]))3 stringview #if (($e. _ Myres) < ($e. _buf_size)) ([$e. _BX._BUF,SB]) #else ([$e. _BX._PTR,SB]))
Modify to the following content
1 std::basic_string<char,*>{2 preview #if ($e. _myres ) < ($e. _buf_size)) ([$e. _bx._buf,s8]) #else ([$e. _bx._ptr,s8]))3 stringview #if (($e . _myres) < ($e. _buf_size)) ([$e. _bx._buf,s8b]) #else ([$e. _bx._ptr,s8b]))
Reference:
- Autoexp.dat Getting Started http://www.thecodeway.com/blog/?p=924
VS2013 modified Autoexp.dat is invalid and needs to be modified
C:\Program files (x86) \microsoft Visual Studio 12.0\common7\packages\debugger\visualizers\stl.natvis file, approximately 755-758 lines
1<type name="std::basic_string<char,*>">2<displaystring condition="_myres < _buf_size">{_Bx._Buf,s8}</DisplayString>3<displaystring condition="_myres >= _buf_size">{_Bx._Ptr,s8}</DisplayString>4<stringview condition="_myres < _buf_size">_Bx._Buf,s8</StringView>5<stringview condition="_myres >= _buf_size">_Bx._Ptr,s8</StringView>
Visual Studio 2010/2013 UTF8 encoding when debugging display Chinese