UTF-8 转 GB2312,该如何解决

UTF-8 转 GB2312
各位高手,谁有UTF-8转gb2312 的示例代码,我从网上找了一些资料,然后用OUTLOOK 发送邮件,自己这边的服务器接受,然后解析,发现还是不行 .谁有代码能分享一下吗.高份相送

------解决方案--------------------
C/C++ code
qp::StringW Global::AnsiToUnicode(const char* buf)
{
    int len = ::MultiByteToWideChar(CP_ACP, 0, buf, -1, NULL, 0);
    if (len == 0) return L"";

    std::vector<wchar_t> unicode(len);
    ::MultiByteToWideChar(CP_ACP, 0, buf, -1, &unicode[0], len);

    return &unicode[0];
}

qp::StringA Global::UnicodeToAnsi(const wchar_t* buf)
{
    int len = ::WideCharToMultiByte(CP_ACP, 0, buf, -1, NULL, 0, NULL, NULL);
    if (len == 0) return "";

    std::vector<char> utf8(len);
    ::WideCharToMultiByte(CP_ACP, 0, buf, -1, &utf8[0], len, NULL, NULL);

    return &utf8[0];
}

qp::StringW Global::Utf8ToUnicode(const char* buf)
{
    int len = ::MultiByteToWideChar(CP_UTF8, 0, buf, -1, NULL, 0);
    if (len == 0) return L"";

    std::vector<wchar_t> unicode(len);
    ::MultiByteToWideChar(CP_UTF8, 0, buf, -1, &unicode[0], len);

    return &unicode[0];
}

qp::StringA Global::UnicodeToUtf8(const wchar_t* buf)
{
    int len = ::WideCharToMultiByte(CP_UTF8, 0, buf, -1, NULL, 0, NULL, NULL);
    if (len == 0) return "";

    std::vector<char> utf8(len);
    ::WideCharToMultiByte(CP_UTF8, 0, buf, -1, &utf8[0], len, NULL, NULL);

    return &utf8[0];
}

------解决方案--------------------
原理
http://www.diybl.com/course/3_program/c++/cppsl/2008227/101920.html

http://blog.csdn.net/yaoohfox/archive/2009/04/20/4093638.aspx

API

------解决方案--------------------
1楼写的很全了,组合在一起就行了。
------解决方案--------------------
GBK、GB2312等与UTF8之间都必须通过Unicode编码才能相互转换:
GBK、GB2312--Unicode--UTF8
UTF8--Unicode--GBK、GB2312
------解决方案--------------------
先Base64解码一次。解码后的格式为Utf-8

=?UTF-8?B?5Zu95a62?=中的?B?应该指的是base64