Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Encoding to UTF8
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01179709
Message ID:
01179711
Vues:
10
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?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform