By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,732 Members | 1,461 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,732 IT Pros & Developers. It's quick & easy.

Problem with Chinese

P: n/a
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="System" %>
<%@ import Namespace="System.IO" %>
<%@ import Namespace="System.Net" %>

<script runat="server">
static string sLanguageSrc = "EN";
static string sLanguageDest = "ZH";
string PathDirectory ;
static FileInfo[] fi ;

void Page_Load(Object Src, EventArgs E )
{
String sAddressEncoded =
HttpUtility.UrlEncode("http://www.etantonio.it/en/index.aspx") ;
String sAddress =
"http://babelfish.altavista.com/babelfish/trurl_pagecontent?url=" +
sAddressEncoded + "&lp=" + sLanguageSrc + "_" + sLanguageDest ;
WebRequest req = WebRequest.Create(sAddress);
WebResponse result = req.GetResponse();
Stream ReceiveStream = result.GetResponseStream();
StreamReader reader = new StreamReader(ReceiveStream, Encoding.UTF8
);
String sHtmlTradotto = reader.ReadToEnd();

String RegStringSymError =
"(?i)\\<script\\slanguage=\"JavaScript\"\\>(\\s\\n )*\\<!--(\\s\\n)*function\\sSymError\\(\\)(\\s|\\n)*{(\\s| \\n)*return\\strue;(\\s|\\n)*}(\\s|\\n)*window.one rror\\s=\\sSymError;(\\s\\n)*//--\\>(\\s\\n)*\\</script\\>";
sHtmlTradotto = Regex.Replace(sHtmlTradotto, RegStringSymError,
"");
Trace.Write("sHtmlTradotto", sHtmlTradotto);

StreamWriter writer = new StreamWriter(
Server.MapPath("/Etantonio/EN/ZH_Tradotta.aspx") , false,
System.Text.Encoding.UTF8) ;
writer.Write(sHtmlTradotto);
writer.Flush();
writer.Close();
}
</script>

<html>
<head>
<title>Traduttore Cinese</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<META name="author" content="Antonio DOttavio">
<META name="keywords" content="Motore Ricerca Gif Animate, Animated
Gif, Gif Animate, Gif, Animated, WebMaster, Web, Azioni, Borsa,
Grafici, Criteri, Elettronica, Telecomunicazioni, Informatica,
Universitą, Economia, Finanza">
<meta name="description" content="Motore Ricerca Gif Animate, Animated
Gif">
<link href="../../Stili.css" rel="stylesheet" type="text/css">
</head>

<body>
</body>
</html>
Jul 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Trying to display Chinese with the charset iso-8859-1? If you want to
display Chinese, all of your page must be in Unicode and not only just a
part of it, the other part being in italian.

Replace iso-8859-1 with utf-8 and take at the following two articles
(especially the end of the first one). The second one is there in case you
need to know the code page for UTF-8 (65001: Response.Codepage = 65001 or
Session.CodePage=65001 but Reponse.CharSet="UTF-8").

http://msdn.microsoft.com/library/de...taencoding.asp

http://support.microsoft.com/?kbid=232580

S. L.

"Antonio" <et*******@libero.it> wrote in message
news:ba**************************@posting.google.c om...
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="System" %>
<%@ import Namespace="System.IO" %>
<%@ import Namespace="System.Net" %>

<script runat="server">
static string sLanguageSrc = "EN";
static string sLanguageDest = "ZH";
string PathDirectory ;
static FileInfo[] fi ;

void Page_Load(Object Src, EventArgs E )
{
String sAddressEncoded =
HttpUtility.UrlEncode("http://www.etantonio.it/en/index.aspx") ;
String sAddress =
"http://babelfish.altavista.com/babelfish/trurl_pagecontent?url=" +
sAddressEncoded + "&lp=" + sLanguageSrc + "_" + sLanguageDest ;
WebRequest req = WebRequest.Create(sAddress);
WebResponse result = req.GetResponse();
Stream ReceiveStream = result.GetResponseStream();
StreamReader reader = new StreamReader(ReceiveStream, Encoding.UTF8
);
String sHtmlTradotto = reader.ReadToEnd();

String RegStringSymError =
"(?i)\\<script\\slanguage=\"JavaScript\"\\>(\\s\\n )*\\<!--(\\s\\n)*function\\sSymError\\(\\)(\\s|\\n)*{(\\s| \\n)*return\\strue;(\\s|\\n)*}(\\s|\\n)*window.one rror\\s=\\sSymError;(\\s\\n)*//--\\>(\\s\\n)*\\</script\\>";
sHtmlTradotto = Regex.Replace(sHtmlTradotto, RegStringSymError,
"");
Trace.Write("sHtmlTradotto", sHtmlTradotto);

StreamWriter writer = new StreamWriter(
Server.MapPath("/Etantonio/EN/ZH_Tradotta.aspx") , false,
System.Text.Encoding.UTF8) ;
writer.Write(sHtmlTradotto);
writer.Flush();
writer.Close();
}
</script>

<html>
<head>
<title>Traduttore Cinese</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<META name="author" content="Antonio DOttavio">
<META name="keywords" content="Motore Ricerca Gif Animate, Animated
Gif, Gif Animate, Gif, Animated, WebMaster, Web, Azioni, Borsa,
Grafici, Criteri, Elettronica, Telecomunicazioni, Informatica,
Universitą, Economia, Finanza">
<meta name="description" content="Motore Ricerca Gif Animate, Animated
Gif">
<link href="../../Stili.css" rel="stylesheet" type="text/css">
</head>

<body>
</body>
</html>

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.