谁做过彩信打包程序
就是把图片、铃声、文字用smil布局然后打包成TMS的那种做的过程中出现一些问题,有做过的朋友吱一声 共同探讨探讨
2010-10-08 10:13
2010-10-08 14:29
2010-10-09 13:48
程序代码: public string UTF8ToGB2312(string str)
{
try
{
Encoding utf8 = Encoding.GetEncoding(65001);
Encoding gb2312 = Encoding.GetEncoding("gb2312");//Encoding.Default ,936
byte[] temp = utf8.GetBytes(str);
byte[] temp1 = Encoding.Convert(utf8, gb2312, temp);
string result = gb2312.GetString(temp1);
return result;
}
catch (Exception ex)//(UnsupportedEncodingException ex)
{
MessageBox.Show(ex.ToString());
return null;
}
}
string txtContent = UTF8ToGB2312(txt); //变量txt就是文本内容
txtFileName = random() + ".txt"; //生成随机文件名
if (!("tms")) { ("tms"); }
FileStream fs_txt = new FileStream("tms\\" + txtFileName, FileMode.Create);
StreamWriter sw_txt = new StreamWriter(fs_txt);
sw_txt.WriteLine(txtContent);
sw_txt.Close();
2010-10-09 14:11
程序代码:Encoding f32 = Encoding.GetEncoding("gb2312");
StreamWriter sw_txt = new StreamWriter(fs_txt,f32);
sw_txt.WriteLine(txt);
sw_txt.Close();
这样就好了,生成的txt编码为ANSI
2010-10-11 14:31