当前位置:编程学习 > C#/ASP.NET >>

关于中文解码问题


public String BodyRTF
            {
                get
                {
                    //get value for the RTF compressed MAPI property
                    byte[] rtfBytes = this.GetMapiPropertyBytes(OutlookStorage.PR_RTF_COMPRESSED);

                    //return null if no property value exists
                    if (rtfBytes == null || rtfBytes.Length == 0)
                    {
                        return null;
                    }

                    //decompress the rtf value
                    rtfBytes = CLZF.decompressRTF(rtfBytes);

                    //encode the rtf value as an ascii string and return
                    string a1 = Encoding.Unicode.GetString(rtfBytes);
                    string a2 = Encoding.Default.GetString(rtfBytes);
                    string a3 = Encoding.UTF8.GetString(rtfBytes);
                    return Encoding.ASCII.GetString(rtfBytes);
                }
            }


无论用哪种方式,中文都是无法解码的。有没有好的建议呢。
font-family里的是中文依旧是\'bc\'d0\'b7\'a2\'c5\'e9 ,用GB2132或者BIG5也无解。
<span style='font-family:\'bc\'d0\'b7\'a2\'c5\'e9;color:#1F497D'> C# --------------------编程问答-------------------- UTF-8 --------------------编程问答--------------------
引用 1 楼 junlinfushi 的回复:
UTF-8
+1 --------------------编程问答-------------------- 各位:
string a1 = Encoding.Unicode.GetString(rtfBytes); 
                    string a2 = Encoding.Default.GetString(rtfBytes); 
                    string a3 = Encoding.UTF8.GetString(rtfBytes); 
                    return Encoding.ASCII.GetString(rtfBytes); 

以上编码,包括UTF8,unicode,简繁体编码都试过了,都是一样的! --------------------编程问答-------------------- 是不是return错了 --------------------编程问答-------------------- 本身就不是正规的编码,需要先拔除杂草。 --------------------编程问答-------------------- 编码格式试试GB2312 --------------------编程问答-------------------- 这个没解了。。因为RTF文件本身就只能用ANSI,不支持中文。所以源码的中文显示不出来,不过在word等里面是可以显示中文的。
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,