• <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 转换为多字节

        时间:2023-07-02
        <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 转换为多字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:调用函数时 C++ 访问冲突读取位置 0xcdcdcdcd 错误 下一篇:在库中使用 fstream 时,我在可执行文件中收到链接器错误

                  相关文章

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

                  1. <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>
                      <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>