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

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

                  相关文档推荐

                  Unable to access non-const member functions of objects in C++ std::set(无法访问 C++ std::set 中对象的非常量成员函数)
                  Constructing std::function argument from lambda(从 lambda 构造 std::function 参数)
                  STL BigInt class implementation(STL BigInt 类实现)
                  Sync is unreliable using std::atomic and std::condition_variable(使用 std::atomic 和 std::condition_variable 同步不可靠)
                  Move list element to the end in STL(在 STL 中将列表元素移动到末尾)
                  Why is overloading operatoramp;() prohibited for classes stored in STL containers?(为什么禁止对存储在 STL 容器中的类重载 operatoramp;()?)

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