• <tfoot id='ytCdd'></tfoot>

    1. <i id='ytCdd'><tr id='ytCdd'><dt id='ytCdd'><q id='ytCdd'><span id='ytCdd'><b id='ytCdd'><form id='ytCdd'><ins id='ytCdd'></ins><ul id='ytCdd'></ul><sub id='ytCdd'></sub></form><legend id='ytCdd'></legend><bdo id='ytCdd'><pre id='ytCdd'><center id='ytCdd'></center></pre></bdo></b><th id='ytCdd'></th></span></q></dt></tr></i><div id='ytCdd'><tfoot id='ytCdd'></tfoot><dl id='ytCdd'><fieldset id='ytCdd'></fieldset></dl></div>

      <small id='ytCdd'></small><noframes id='ytCdd'>

        <legend id='ytCdd'><style id='ytCdd'><dir id='ytCdd'><q id='ytCdd'></q></dir></style></legend>
        • <bdo id='ytCdd'></bdo><ul id='ytCdd'></ul>

        将 Unicode 转换为多字节

        Converting Unicode to Multibyte(将 Unicode 转换为多字节)
        <legend id='hdgrI'><style id='hdgrI'><dir id='hdgrI'><q id='hdgrI'></q></dir></style></legend>
          <bdo id='hdgrI'></bdo><ul id='hdgrI'></ul>

          1. <tfoot id='hdgrI'></tfoot>

              <i id='hdgrI'><tr id='hdgrI'><dt id='hdgrI'><q id='hdgrI'><span id='hdgrI'><b id='hdgrI'><form id='hdgrI'><ins id='hdgrI'></ins><ul id='hdgrI'></ul><sub id='hdgrI'></sub></form><legend id='hdgrI'></legend><bdo id='hdgrI'><pre id='hdgrI'><center id='hdgrI'></center></pre></bdo></b><th id='hdgrI'></th></span></q></dt></tr></i><div id='hdgrI'><tfoot id='hdgrI'></tfoot><dl id='hdgrI'><fieldset id='hdgrI'></fieldset></dl></div>

                <small id='hdgrI'></small><noframes id='hdgrI'>

                    <tbody id='hdgrI'></tbody>
                  本文介绍了将 Unicode 转换为多字节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个小问题,我想将 unicode 转换为多字节有什么办法

                  I have smalll problem i want to convert unicode into Multi byte is there any way

                  推荐答案

                  std::string NarrowString(const std::wstring& str, const char* localeName = "C")
                  {
                    std::string result;
                    result.resize(str.size());
                  
                    std::locale loc(localeName);
                  
                    std::use_facet<std::ctype<wchar_t> >(loc).narrow(
                      str.c_str(), str.c_str() + str.size(), '?',  &*result.begin());
                  
                    return result;
                  }
                  

                  它应该使用当前的语言环境来转换 unicode 字符串.对于不属于代码页的字符,'?'正在使用字符.使用 Visual C++ 2005/2008 测试.

                  It should use the current locale to convert the unicode string. For the caracters that do not belong in the codepage the '?' caracter is being used. Tested with Visual C++ 2005/2008.

                  这篇关于将 Unicode 转换为多字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to print vector#39;s data(如何打印矢量的数据)
                  Visual C++ appends 0xCC (int3) bytes at the end of functions(Visual C++ 在函数末尾附加 0xCC (int3) 字节)
                  How to use a variable inside a _T wrapper?(如何在 _T 包装器中使用变量?)
                  MSVC++ warning flags(MSVC++ 警告标志)
                  How to read file which contains uxxxx in vc++(如何在vc++中读取包含uxxxx的文件)
                  stack overflow error in C++ program(C++程序中的堆栈溢出错误)

                          <bdo id='8A6Nu'></bdo><ul id='8A6Nu'></ul>

                        • <small id='8A6Nu'></small><noframes id='8A6Nu'>

                          <tfoot id='8A6Nu'></tfoot>
                          1. <legend id='8A6Nu'><style id='8A6Nu'><dir id='8A6Nu'><q id='8A6Nu'></q></dir></style></legend>
                              <tbody id='8A6Nu'></tbody>
                            <i id='8A6Nu'><tr id='8A6Nu'><dt id='8A6Nu'><q id='8A6Nu'><span id='8A6Nu'><b id='8A6Nu'><form id='8A6Nu'><ins id='8A6Nu'></ins><ul id='8A6Nu'></ul><sub id='8A6Nu'></sub></form><legend id='8A6Nu'></legend><bdo id='8A6Nu'><pre id='8A6Nu'><center id='8A6Nu'></center></pre></bdo></b><th id='8A6Nu'></th></span></q></dt></tr></i><div id='8A6Nu'><tfoot id='8A6Nu'></tfoot><dl id='8A6Nu'><fieldset id='8A6Nu'></fieldset></dl></div>