473,783 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Data record from Database, displaying as special characters in webpage

Hello,

I am displaying data retrieved from a database as a httpresponse in a
webform.
I noticed that some characters such as the comma (,), display as
special characters in the
web browser (Internet Explorer). It displays something like $^^%
instead of a comma.
Please how can I have the browser display the comma as it is from the
database.

Please find below a sample code of the code that packages the data
responseString into a
httpresponse object for display in the browser.

Thank you.

Regards,

Chike

//Make sure the response string length is not greater than 160.
if (responseString .Length 160)
{
responseString = responseString. Substring(0,
160);
}

// Obtain a response object
HttpResponse httpresponse = Page.Response;
byte[] buffer = Encoding.UTF8.G etBytes(respons eString);

// Get a response stream and write the response to it
// httpresponse.Co ntentLength64 = buffer.Length;
httpresponse.Co ntentType = "text/plain";
httpresponse.Ou tputStream.Writ e(buffer, 0,
buffer.Length);
httpresponse.Fl ush(); httpresponse.Cl ose();
}
catch (Exception exception)
{
//Console.WriteLi ne(exception.Me ssage);
//Console.WriteLi ne(exception.St ackTrace);
Jan 23 '08 #1
2 2361
On Jan 23, 4:45 pm, chike_...@yahoo .com wrote:
I am displaying data retrieved from a database as a httpresponse in a
webform. I noticed that some characters such as the comma (,), display as
special characters in the
web browser (Internet Explorer). It displays something like $^^%
instead of a comma.
Something like? It would help if you could be exact.

See http://pobox.com/~skeet/csharp/debuggingunicode.html for details
of how to track down this kind of thing.

Jon
Jan 23 '08 #2
Hi Jon,

The character that get misrepresented is the apostrophe (').For
example the word Obasanjo's is represented as ObasanjoâEURO(t m)s.

In some places, it gets represented well.

I don't understand why it is not uniform. Is it likely as a result of
data entry from different types of keyboards or as a result of
character encoding formats?

Any help will be appreciated.

Thank you very much.

Regards

Chike

On Jan 23, 5:51 pm, "Jon Skeet [C# MVP]" <sk...@pobox.co mwrote:
On Jan 23, 4:45 pm, chike_...@yahoo .com wrote:
I am displaying data retrieved from a database as a httpresponse in a
webform. I noticed that some characters such as the comma (,), display as
special characters in the
web browser (Internet Explorer). It displays something like $^^%
instead of a comma.

Something like? It would help if you could be exact.

Seehttp://pobox.com/~skeet/csharp/debuggingunicod e.htmlfor details
of how to track down this kind of thing.

Jon
Jan 23 '08 #3

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

Similar topics

3
17210
by: Barry Olly | last post by:
Hi, I'm working on a mini content management system and need help with dealing with special characters. The input are taken from html form which are then stored into a varchar column in oracle database. When i retrieve the data, some of the special characters have been changed to ??? and also
2
2292
by: John Smith | last post by:
I have a table that contains a chunk of text, and the text commonly has special characters, such as "&amp;" or "–". To edit this text, there is a page where the text is dumped into a textarea. However, IE interprets the special characters, instead of their values. How can I have it so that when the text from the database is displayed inside a textbox, IE does not display the characters but instead their values? Thank you!
3
6519
by: Jens Kristensen | last post by:
I have a problem displaying a divbox containing a html-textarea - everything works fine with "normal" characters. However, when the textarea contains special chars like <P> or ' , the box fails to show: function show(divbox) { divbox.style.display=''; } <div id="divbox" style="display:none" >
4
3489
by: Kivanc Toker | last post by:
Hi, I've got a problem with displaying texts with turkish characters. There is a website administration system, which is developed using ASP (VBScript) and ADO. This system is being used for inserting product informations in to a ms-sql database. There is another webbased application, which is developed using ASP.NET and ADO.NET (C#). For this second application there is a separate ms-sql
8
10563
by: eugenio | last post by:
Hi...not sure if this is the right group for this posting, but i'm don't know where else to post. I've got a simple problem...I have a linux box running apache 2.0 and php5. I'm trying to use the mssql functions in php to retreive data from a mssql server 2k. I'm pulling data from the customers table in the northwind db and i'm getting strange characters instead of special characters. Below is a sample output: (where the quotes are i...
1
1775
by: adridder | last post by:
Hey ... i'm fetching my database information with php for example: "m²" or "kint&co" then retrieving this with a XMLHttpObject request, and putting it on my page with innerHTML the result would be
6
3879
by: TheRealDan | last post by:
Hi all. I'm having a problem with a special characters. I have php script that reads from an xml file and writes to a mysql db. It's a script called phptunest that I found on the net, although the original website for the author appears to be gone. It works really nicely except when it hits special characters. Everything from a sp char forward just gets lost. It is using mysql_real_escape_string, but that doesn't seem to help with the ...
2
2161
by: Raju1984 | last post by:
If i store the string which contains special characters(®) in MySQL database ,it stores special characters as it is. But when i try to diplay that string using HTML & queries, it shows '?' character for ® in Firefox & shows some another character in Internet Explorer. Please try to answer that!
6
4432
by: rellaboyina | last post by:
Dear All, I am having some data which will be stored in XML format and this needs to be parsed using the parser module XML::Parser and XML::Parser::Expat. This data consists of some special characters like "ø, á, í, é, È, ž, ù, ý". But when I try to parse the particular record with these special characters using the method parse(), I got an error "not well-formed (invalid token)". Could anyone please help me out in solving this...
1
1592
by: ziycon | last post by:
Basically if there is a special character it will display fine on the page when you first go to the page but when you submit something new and the AJAX reloads the data on screen all special characters show up as unrecognised. Is there a way to handle special characters in AJAX properly, data is stored in a UTF-8 database??
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6735
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.