Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / April 2005



Tip: Looking for answers? Try searching our database.

setting file encoding to utf-8

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rama - 26 Apr 2005 05:43 GMT
HI,

In my VB application, I have to create a txt file, write the string into the
file and while saving need to set the Encoding of file to UTF-8. By default
it is ANSI. Is anybody know how to do this in VB?

Thanks & Regards,
Rama
Tony Proctor - 26 Apr 2005 09:50 GMT
You first need to convert the VB String data from Unicode to a UTF-8 byte
array (e.g. using something like:
http://www.google.ie/groups?safe=off&as_umsgid=%23%24QgKiUfDHA.2748@TK2MSFTNGP11
.phx.gbl&lr=lang_en&hl=en
),
and then write it to your file using binary file I/O.

NB: Don't store UTF-8 data in String variables, only byte arrays (String
data should only hold real Unicode text). Also, don't use normal record I/O
to the file, use binary (this avoids any conversion of the data as ANSI)

       Tony Proctor

> HI,
>
[quoted text clipped - 4 lines]
> Thanks & Regards,
> Rama
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.