473,396 Members | 1,871 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,396 software developers and data experts.

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.GetBytes(responseString);

// Get a response stream and write the response to it
// httpresponse.ContentLength64 = buffer.Length;
httpresponse.ContentType = "text/plain";
httpresponse.OutputStream.Write(buffer, 0,
buffer.Length);
httpresponse.Flush(); httpresponse.Close();
}
catch (Exception exception)
{
//Console.WriteLine(exception.Message);
//Console.WriteLine(exception.StackTrace);
Jan 23 '08 #1
2 2343
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(tm)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.comwrote:
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/debuggingunicode.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
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...
2
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....
3
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...
4
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...
8
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...
1
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...
6
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...
2
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...
6
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...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.