- 博客(1)
- 资源 (5)
- 收藏
- 关注
原创 如何在退出一个页面时自动清空session变量
如何在退出一个页面时自动清空session变量第一步、在间加入function loginout(){var gt = unescape(%3e);var popup = null;var over = "Launch Pop-up Navigator";popup = window.open(, popupnav,width=225,height=235
2004-10-19 20:36:00 2921
NChardet文本文件编码探测库源码,C#,txt文件编码自动探测
NChardet文本文件编码探测库源码,C#,txt文件编码自动探测
用于自动探测TXT文本文件编码,支持GB2312、UTF-8、ASCII等几乎所有主流编码的探测,使用方法如下:
static public Encoding GetEncoding(string bookPath, ref string charsetName)
{
charsetName = "";
//1. Japanese
//2. Chinese
//3. Simplified Chinese
//4. Traditional Chinese
//5. Korean
//6. Dont know (默认)
int lang = 2;//
//用指定的语参数实例化Detector
Detector det = new Detector(lang);
//初始化
MyCharsetDetectionObserver cdo = new MyCharsetDetectionObserver();
det.Init(cdo);
//输入字符流
//Uri url = new Uri(“http://cn.yahoo.com”);
//HttpWebRequest request =
// HttpWebRequest)WebRequest.Create(url);
//HttpWebResponse response =
// (HttpWebResponse)request.GetResponse();
Stream stream = File.OpenRead(bookPath);
byte[] buf = new byte[1024];
int len;
bool done = false;
bool isAscii = true;
bool found = false;
while ((len = stream.Read(buf, 0, buf.Length)) != 0)
{
// 探测是否为Ascii编码
if (isAscii)
isAscii = det.isAscii(buf, len);
// 如果不是Ascii编码,并且编码未确定,则继续探测
if (!isAscii && !done)
done = det.DoIt(buf, len, false);
}
stream.Close();
stream.Dispose();
//调用DatEnd方法,
//如果引擎认为已经探测出了正确的编码,
//则会在此时调用ICharsetDetectionObserver的Notify方法
det.DataEnd();
if (isAscii)
{
//Console.WriteLine("CHARSET = ASCII");
found = true;
}
else if (cdo.Charset != null)
{
//Console.WriteLine("CHARSET = {0}", cdo.Charset);
found = true;
}
if (found)
{
charsetName = cdo.Charset;
return GetEncodingFromEncodingName(cdo.Charset);
}
if (!found)
{
charsetName = "";
string[] prob = det.getProbableCharsets();
for (int i = 0; i < prob.Length; i++)
{
//Console.WriteLine("Probable Charset = " + prob[i]);
}
return Encoding.Default;
}
return Encoding.Default;
}
static public Encoding GetEncodingFromEncodingName(string charset)
{
if (string.IsNullOrWhiteSpace(charset))
{
charset = "gb2312";
}
return Encoding.GetEncoding(charset);
}
2013-07-08
Bitmap Font Generator1.14beta,BMFont1.14beta,游戏字体工具
强大的游戏字体工具BMFont1.14beta版。
用于生成游戏字体图
支持中文字体,支持UTF-8,支持通过文本文件部分选中常用字(txt请保存为UTF-8编码)
英文版本
2013-07-08
TexturePacker3.0.9破解版 windows版
此版本为windows版
用压缩包中的安装文件安装后,将TexturePackerGUI_crack.exe放到安装文件夹,双击运行。
用于生成游戏可用的2D图像资源
支持cocos2D, U3D等主流游戏引擎及多种图像格式
2013-07-08
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人