怎么URL编码和UTF-8编码

如何URL编码和UTF-8编码
还有BASE64编码...给跪啦..新手

------解决方案--------------------
base 64 : #include <atlenc.h>
utf-8: WideCharToMultiByte(CP_UTF8, ...)
url的因为是公司代码,不方便贴
------解决方案--------------------
开源的有很多啊,搜一下 url encode
------解决方案--------------------
C/C++ code
//**************************************
// unicode字符串转utf8字符串
// 返回大于0成功,小于0失败
//**************************************
int
ustr_u8str( WCHAR *unicodestr, char *utf8str )
{
    int result = 0;
    try
    {
        int needlen = WideCharToMultiByte( CP_UTF8, 0, unicodestr, -1, NULL, 0, NULL, NULL );
        if( needlen < 0 )
        {
            return needlen;
        }

        result = WideCharToMultiByte( CP_UTF8, 0, unicodestr, -1, utf8str, needlen + 1, NULL, NULL );
        if( result < 0 )
        {
            return result;
        }
        return ( result - 1 );
    }
    catch( ... )
    {
        ShowError();
    }
    return result;
}