473,320 Members | 2,098 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,320 software developers and data experts.

Displaying international charachters

I have a website that does the following:

1. it accepts a keyword through a textbox in the UI
2. once the submit button is clicked it goes out and spiders a few
websites using the keyword supplied
3. it converts the returned html to xml
4. it uses LINQ to query the html page and stores the results in a
database table
5. it then pulls the results from the database using a LINQ query ad
displays them on a webpage

The problem I am facing is that I am not able to display international
charachters (charachters not in the english alphabet) in step 5

When I spider the pages in step 2 I use Encoding.UTF7. Using UTF7
successfully allows me to capture international charachters. When I
commit the data to the database in step 4 I can see that the data is
stored and displayed correctly when I view the table in Enterprise
Manager.

When I query the database for the results in step 5 and try to diplay
them on a aspx page, they show up as ù

What am I doing wrong?
Oct 2 '08 #1
3 1470

"Nightcrawler" wrote:
I have a website that does the following:

1. it accepts a keyword through a textbox in the UI
2. once the submit button is clicked it goes out and spiders a few
websites using the keyword supplied
3. it converts the returned html to xml
4. it uses LINQ to query the html page and stores the results in a
database table
5. it then pulls the results from the database using a LINQ query ad
displays them on a webpage

The problem I am facing is that I am not able to display international
charachters (charachters not in the english alphabet) in step 5

When I spider the pages in step 2 I use Encoding.UTF7. Using UTF7
successfully allows me to capture international charachters. When I
commit the data to the database in step 4 I can see that the data is
stored and displayed correctly when I view the table in Enterprise
Manager.

When I query the database for the results in step 5 and try to diplay
them on a aspx page, they show up as ù

What am I doing wrong?
Hi,

I suspect you aren't formatting the UTF7-text properly when reading from the
database or before displaying on the web page. As UTF7 poses a security risk
you should consider using UTF8 or another encoding instead.

--
Happy Coding!
Morten Wennevik [C# MVP]
Oct 3 '08 #2
How do I format text when reading from a database? I use a simple LINQ
query to pull the data through a stored procedure. Can you point me in
the right direction as to how to do that?

Much appreciated.

Thanks
Oct 3 '08 #3

"Nightcrawler" wrote:
How do I format text when reading from a database? I use a simple LINQ
query to pull the data through a stored procedure. Can you point me in
the right direction as to how to do that?

Much appreciated.

Thanks
You may need to convert the text you get to another encoding. To
demonstrate the problem the code below will write "2 + 2 = 4" in utf7 to a
file. The default reading method will however use utf8 and you will end up
with "2 +- 2 +AD0- 4"

File.WriteAllText("C:\\Temp\\utf7.txt", "2 + 2 = 4", Encoding.UTF7);
string utf7Text = File.ReadAllText("C:\\Temp\\utf7.txt");

byte[] data = Encoding.UTF8.GetBytes(utf7Text);
string unicode = Encoding.UTF7.GetString(data);

--
Happy Coding!
Morten Wennevik [C# MVP]
Oct 5 '08 #4

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

Similar topics

9
by: Jenta | last post by:
A World Beyond Capitalism 2005, An Annual International Multiracial Alliance Building Peace Conference Is Accepting Proposals... ...and Online Registration is now available if you plan to table...
0
by: MarionEll | last post by:
XML 2004 Shows International Side to XML Alexandria, Va. - Oct. XX, 2004 - IDEAlliance, a leading industry association dedicated to fostering XML and other information technology standards, today...
20
by: John Doe | last post by:
I write code as long as 250+ columns sometimes (when the code refers to a single concept), and I don't understand why people complain about that. Just use the word wrap, right? People who write...
0
by: Conference Secretary | last post by:
CALL FOR PAPERS International Conference on Intelligent Agents, Web Technologies and Internet Commerce http://www.ise.canberra.edu.au/conferences/iawtic05/ Jointly with International...
0
by: Conference Secretary | last post by:
CALL FOR PAPERS International Conference on Intelligent Agents, Web Technologies and Internet Commerce http://www.ise.canberra.edu.au/conferences/iawtic05/ Jointly with International...
0
by: Yeongja_Choi | last post by:
How Dare Could America Industrial Property Office Be In Conspiracy With Jungang International Patent Office To Make An Extravagant International Crime ? Currently a Korean party now holds the...
0
by: avinash | last post by:
International Conference on Computational Intelligence and Multimedia Applications, August 16-18, 2005 University of Nevada, Las Vegas, USA (www.iccima.org) F I R S T C A L L F O R P...
0
by: MarionEll | last post by:
XML 2004 Shows International Side to XML Alexandria, Va. - Oct. XX, 2004 - IDEAlliance, a leading industry association dedicated to fostering XML and other information technology standards, today...
1
by: VMI | last post by:
I'm working on an ecommerce-type we app, and I would like to save/retrieve image information into my sql server DB. If I save the file path in my table, how can I use that info to display the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.