UTF8Encoding string doesn't display correctly in FireFox

  • Thread starter Thread starter Don Chen
  • Start date Start date
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!
 
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
 
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!
 
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
 
The returned string all have the same length 17, but in IE it doesn't display
the non-printable characters, and Firefox does. Strange!
 
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
 
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
 
Back
Top