473,385 Members | 1,588 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Strange encoding behaviour

Good Morning,
I've the following problem :

I want to translate some page of my site using babelfish translator of
Altavista,
To avoid manual job I want to deliver a c# script that produce this
result.

I've putted this page on my site at the url
http://www.etantonio.it/EN/Economia/indexTest.aspx

////////////////////////////////////////////////////////
<html>
<title>Economy</title>
</head>
<body>
<p align="center">Economy</p>
</body>
</html>
////////////////////////////////////////////////////////

If I try to translate this using altavista, the result is directly
available at
the url http://babelfish.altavista.com/babel...indexTest.aspx
and it's working OK, the translation of Economy in French is Économie
, the problem is in the first letter of Économie
, the É is not well recognized instead by the following my c# script

///////////////////////////////////////////////////////////////////////////////
<%@ Page Language="c#" debug="true" trace="true"
ResponseEncoding="utf-8"%>
<%@ import Namespace="System" %>
<%@ import Namespace="System.IO" %>
<%@ import Namespace="System.Net" %>
<script runat="server">
void Page_Load(Object Src, EventArgs E )
{
String sAddress =
"http://babelfish.altavista.com/babelfish/trurl_pagecontent?doit=done&tt=url&intl=1&lp=en_fr &url=http%3A%2F%2Fwww.etantonio.it%2Fen%2Feconomia %2FindexTest.aspx"
;
WebRequest req = WebRequest.Create(sAddress);
WebResponse result = req.GetResponse();
Stream ReceiveStream = result.GetResponseStream();
StreamReader reader = new StreamReader(ReceiveStream, Encoding.UTF8
);
String sHtmlTradotto = reader.ReadToEnd();
Trace.Write("sHtmlTradotto", sHtmlTradotto);
}
</script>
///////////////////////////////////////////////////////////////////////////////
whose result is available at the url

http://www.etantonio.it/Utility/Trad...FrRidotto.aspx

and basically shows that the É of Économie is blanked.

How can I solve the problem and finally obtain this translation ??

I think the problem is not in the code because if I use it for this
other address string

String sAddress =
"http://www.etantonio.it/Utility/Traduzioni/FR.aspx" ;
Can you help me ???
Many thanks in any case ...

Engineer Antonio D'Ottavio
www.etantonio.it/en
po********@etantonio.it
Nov 16 '05 #1
2 1811
How does the string look when you run it through the debugger?
Nov 16 '05 #2
Antonio <et*******@libero.it> wrote:
Good Morning,
I've the following problem :

I want to translate some page of my site using babelfish translator of
Altavista,
To avoid manual job I want to deliver a c# script that produce this
result.


<snip>

The problem is that although the *page* claims that the content is in
UTF-8, it's not - it's actually in ISO-8859-1, which is what the
*headers* claim.

If you change your code to use Encoding.GetEncoding(28591) you'll get
the right result - but only for that particular page, of course...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Sebastian Meyer | last post by:
Hi newsgroup, i am trying to replace german special characters in strings like str = re.sub('ö', 'oe', str) When i work with this, i always get the message UniCode Error: ASCII decoding error...
2
by: Juho Vuori | last post by:
Hello, I'm wondering about the following behaviour of str() with strings containing non-ASCII characters: str(u'foo') returns 'foo' as expected. str('lää') returns 'lää' as expected. ...
1
by: Sam | last post by:
Hi there, I really someone can help me. This is a real head scratcher... I have an XSLT stylesheet that transforms perfectly when I embed the link to it in an XML document. But if I try to use...
1
by: Antonio | last post by:
Hy Jon, Still some problem, because I want to use also the chinese translation for the page http://www.etantonio.it/EN/Economia/indexTest.aspx whose code is the following : ...
10
by: Oscar Thornell | last post by:
Hi, I generate and temporary saves a text file to disk. Later I upload this file to Microsoft MapPoint (not so important). The file needs to be in UTF-8 encoding and I explicitly use the...
9
by: Mark | last post by:
I've run a few simple tests looking at how query string encoding/decoding gets handled in asp.net, and it seems like the situation is even messier than it was in asp... Can't say I think much of the...
4
by: liam_weston | last post by:
I have 2 supposedly identical Windows 2000 web servers each with IIS5. Both have the ASPCODEPAGE set to 65001 (utf-8) in the metabase. The first server has been running pages like the one below...
3
by: CyberSpyders | last post by:
Hi, I have an ASP.Net website, which allows users to upload a file which is then inserted into a database. This is all fine until it reads a line with the string +Anu in it. It transforms...
8
by: Dox33 | last post by:
I ran into a very strange behaviour of raw_input(). I hope somebody can tell me how to fix this. (Or is this a problem in the python source?) I will explain the problem by using 3 examples....
5
by: ioni | last post by:
Good day, fellows! I have a strange problem – at my site there is a flash strip, that loads data dynamically. It works fine (grabs data from the remote server and presents it), however in IE7...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.