With the following page aspx
I try to translate one my page from English to Chinese, using UTF8,
the result Is that the Chinese characters do not come read correctly,
if instead I insert directly the address
http://babelfish.altavista.com/babel....aspx&lp=en_zh
into the browser the page he comes shown correctly in Chinese, if i
save it and put it in my site and with the same below script I try to
read it and to save it always with utf8, the Chinese characters come
saves you normally, than problem there is to your opinion? My scope is
to save in automatic way in a file with extension aspx the content of
the page http://babelfish.altavista.com/babel....aspx&lp=en_zh
hello and thanks....
Antonio D'Ottavio
www.etantonio.it
<%@ Page Language="c#" debug="true" trace="true"%>
<%@ import Namespace="Syst em" %>
<%@ import Namespace="Syst em.IO" %>
<%@ import Namespace="Syst em.Net" %>
<script runat="server">
static string sLanguageSrc = "EN";
static string sLanguageDest = "ZH";
string PathDirectory ;
static FileInfo[] fi ;
void Page_Load(Objec t Src, EventArgs E )
{
String sAddressEncoded =
HttpUtility.Url Encode("http://www.etantonio.i t/en/index.aspx") ;
String sAddress =
"http://babelfish.altav ista.com/babelfish/trurl_pageconte nt?url=" +
sAddressEncoded + "&lp=" + sLanguageSrc + "_" + sLanguageDest ;
WebRequest req = WebRequest.Crea te(sAddress);
WebResponse result = req.GetResponse ();
Stream ReceiveStream = result.GetRespo nseStream();
StreamReader reader = new StreamReader(Re ceiveStream, Encoding.UTF8
);
String sHtmlTradotto = reader.ReadToEn d();
String RegStringSymErr or =
"(?i)\\<script\ \slanguage=\"Ja vaScript\"\\>(\ \s\\n)*\\<!--(\\s\\n)*functi on\\sSymError\\ (\\)(\\s|\\n)*{ (\\s|\\n)*retur n\\strue;(\\s|\ \n)*}(\\s|\\n)* window.onerror\ \s=\\sSymError; (\\s\\n)*//--\\>(\\s\\n)*\\</script\\>";
sHtmlTradotto = Regex.Replace(s HtmlTradotto, RegStringSymErr or,
"");
Trace.Write("sH tmlTradotto", sHtmlTradotto);
StreamWriter writer = new StreamWriter(
Server.MapPath( "/Etantonio/EN/ZH_Tradotta.asp x") , false,
System.Text.Enc oding.UTF8) ;
writer.Write(sH tmlTradotto);
writer.Flush();
writer.Close();
}
</script>
<html>
<head>
<title>Tradutto re Cinese</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<META name="author" content="Antoni o DOttavio">
<META name="keywords" content="Motore Ricerca Gif Animate, Animated
Gif, Gif Animate, Gif, Animated, WebMaster, Web, Azioni, Borsa,
Grafici, Criteri, Elettronica, Telecomunicazio ni, Informatica,
Università, Economia, Finanza">
<meta name="descripti on" content="Motore Ricerca Gif Animate, Animated
Gif">
<link href="../../Stili.css" rel="stylesheet " type="text/css">
</head>
<body>
</body>
</html>