当前位置:首页 > 网络编程 > 软件语言 > .NET > C#中生成中文繁体web页面

C#中生成中文繁体web页面

点击次数:51 次 发布日期:2008-11-06 07:54:57 作者:源代码网
源代码网推荐
广告载入中

源代码网整理以下1 在工程中引用Microsoft.VisualBasic.dll

源代码网整理以下一般此文件在.net框架环境目录中如C: WINNT Microsoft.NET Framework v1.1.4322

源代码网整理以下Microsoft.VisualBasic.dll。

源代码网整理以下 

源代码网整理以下2 使用方法

源代码网整理以下Microsoft.VisualBasic.Strings.StrConv(“instr”,Microsoft.VisualBasic.VbStrConv.TraditionalChinese,System.Globalization.CultureInfo.CurrentCulture.LCID);

软件开发网 www.mscto.com

源代码网整理以下* 该方法的使用可以在msdn中找到。

源代码网整理以下3 生成web页面使用编码 950,代码如下:

源代码网整理以下//写文件

源代码网整理以下public bool WriteFile( string contentStr,string filepath )

源代码网整理以下{

源代码网整理以下try

源代码网整理以下{

源代码网整理以下if ( filepath == null) 软件开发网 www.mscto.com

源代码网整理以下return false;

源代码网整理以下this.CreateDir( filepath.Substring( 0,filepath.LastIndexOf( "\" ) ) );

源代码网整理以下StreamWriter outStream = new StreamWriter( filepath,false,System.Text.Encoding.GetEncoding( 950 ) );

源代码网整理以下outStream.Write( contentStr );

源代码网整理以下outStream.Close();

源代码网整理以下return true;

软件开发网 www.mscto.com

源代码网整理以下}

源代码网整理以下catch

源代码网整理以下{

源代码网整理以下return false;

源代码网整理以下}

源代码网整理以下}

源代码网整理以下 

源代码网整理以下4 读简体文件时使用编码 936

源代码网整理以下//读文件

源代码网整理以下public string ReadFile( string filepath )

源代码网整理以下{

源代码网整理以下string reStr = "";

软件开发网 www.mscto.com

源代码网整理以下if ( filepath ==null ) return reStr;

源代码网整理以下using ( StreamReader sr = new StreamReader( filepath,System.Text.Encoding.GetEncoding( 936 ) ) )

软件开发网 www.mscto.com

源代码网整理以下{

源代码网整理以下string line;

源代码网整理以下while( (line = sr.ReadLine())!=null )

源代码网整理以下{

源代码网整理以下reStr += line+" "; 软件开发网 www.mscto.com

源代码网整理以下}

源代码网整理以下}

源代码网整理以下return reStr;

源代码网整理以下}


源代码网推荐

源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华