Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Encoding to UTF8
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01179709
Message ID:
01179711
Views:
9
Uh, whatever that formatting you're proposing is, it's not UTF-8. Space is not something that is UTF-8 encoded. In fact, none of the lower 128 base ascii bytes should encode.

For UTF-8 encoding you should use System.Text.Encoding.UTF8. Something like this:
string Text = "This is some text - æ I ¢ üì";
byte[] Buffer = Encoding.UTF8.GetBytes(Text);
string Utf8String = Encoding.UTF8.GetString(Buffer);
In fact the string returned from the above will be something very ugly (probably won't show correctly here):

This is some text - æ I ¢ üì

You can apply additional encoding to that string after the fact, but I don't recognize what type of encoding you're using there...

HtmlEncoding will yield:

This is some text - æ I ¢ üì



+++ Rick ---


>Hi all
>
>How do I encode to UTF8 a string containing:
>"XXX Status Updates"
>so the end result will be:
>"XXX_x0020_Status_x0020_Updates"
>
>Notice that there are other kind of replacements as "/", etc that UTF8 encodes, and that is what I need.
>
>I'm trying hard but so far is it not working... sometimes it is something simple as this what makes you waste so much time...
>
>TIA
>Max
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform