UTF8Encoding string doesn't display correctly in FireFox

D

Don Chen

Hello,

I have vb.net code behind returns utf8encode string to a web form hidden
field. The returned string contains bunch of ? marks. It doesn't do that
with IE and Safari. Only with FireFox. I can't understand why. Can anybody
help me?

Code snippet:

Dim utf8Converter As New UTF8Encoding
Dim decryptedString As String
decryptedString = utf8Converter.GetString(fromEncrypted)

Return decryptedString

Thanks!
 
M

Michel Posseth [MCP]

Your document needs a doctype as well, HTML or XHTML, transitional or
strict:


Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
</head>
.........HTH

Michel Posseth
 
D

Don Chen

Thanks, but that didn't help. I am still getting this "test������������". I
only need "test", not rest of those non-printable characters. I also have
Firefox encoding set to utf-8.

Thanks!
 
M

Michel Posseth [MCP]

maybe you could post an copy paste example so we can reproduce , cause on
my side everything seems to work fine in my tests

regards

Michel
 
D

Don Chen

The returned string all have the same length 17, but in IE it doesn't display
the non-printable characters, and Firefox does. Strange!
 
A

Andrew Morton

Don said:
Thanks, but that didn't help. I am still getting this
"test????????????". I only need "test", not rest of those
non-printable characters. I also have Firefox encoding set to utf-8.

Do you have
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

in the <head> section? You cannot rely on end-users to go and change FF's
default encoding. Or, indeed, rely on them to /not/ change FF's default
encoding.

Andrew
 
D

Don Chen

Yes, I do, but that didn't help. Thanks.

Andrew Morton said:
Do you have
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

in the <head> section? You cannot rely on end-users to go and change FF's
default encoding. Or, indeed, rely on them to /not/ change FF's default
encoding.

Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top