473,503 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

generate text file with other codepage or encoding

Hi,

I've got this code:

Dim fo As File
Dim swriter As StreamWriter

swriter = fo.CreateText("c:\prueba.txt")
swriter.Write("this is a test")
swriter.Close()

I'd like to generate this text file choosing the encoding or codepage that I
want. Is there any class I can use to do it?I've tried with 'Encoding'
class, but I don't know how to use it to generate the file with the encoding
I want.

thanks.
Nov 21 '05 #1
3 1699
"fabian" <fa******@navegalia.com> schrieb:
I'd like to generate this text file choosing the encoding or codepage that
I
want. Is there any class I can use to do it?I've tried with 'Encoding'
class, but I don't know how to use it to generate the file with the
encoding
I want.


Use 'StreamWriter' only and pass the desired encoding to its constructor
(see documentation for overloaded 'StreamWriter' constructors).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
sorry Herfried,

could you give me an example?
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> escribió en el mensaje
news:eJ**************@TK2MSFTNGP11.phx.gbl...
"fabian" <fa******@navegalia.com> schrieb:
I'd like to generate this text file choosing the encoding or codepage
that I
want. Is there any class I can use to do it?I've tried with 'Encoding'
class, but I don't know how to use it to generate the file with the
encoding
I want.


Use 'StreamWriter' only and pass the desired encoding to its constructor
(see documentation for overloaded 'StreamWriter' constructors).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
Ok, I got it. Thanks a lot!
"fabian" <fa******@navegalia.com> escribió en el mensaje
news:eQ**************@TK2MSFTNGP10.phx.gbl...
sorry Herfried,

could you give me an example?
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> escribió en el
mensaje news:eJ**************@TK2MSFTNGP11.phx.gbl...
"fabian" <fa******@navegalia.com> schrieb:
I'd like to generate this text file choosing the encoding or codepage
that I
want. Is there any class I can use to do it?I've tried with 'Encoding'
class, but I don't know how to use it to generate the file with the
encoding
I want.


Use 'StreamWriter' only and pass the desired encoding to its constructor
(see documentation for overloaded 'StreamWriter' constructors).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
687
by: Christopher H. Laco | last post by:
Long story longer. I need to get web user input into a backend system that a) only grocks single byte encoding, b) expectes the data transer to be 1 bytes = 1 character, and c) uses the HP Roman-6...
7
4768
by: Kueishiong Tu | last post by:
I have a text file with wide characters. I use the following C++ code to read them in. However the wide characters are read in properly. What is wrong? String* path = "C:\\Documents and...
13
6082
by: Dan V. | last post by:
How do I create a one line text file with these control codes? e.g.: 144 = 0x90 and 147 = 0x93? I am trying to create a one line text file with these characters all one one row with no spaces. ...
4
7104
by: Ram | last post by:
Dear All, Good Day I am trying to convert a file which is generated on AS400 with codepage 00420 (arabic & English data combination) with no success. But using the same code( and changing 20420...
5
15016
by: Lenard Gunda | last post by:
hi! I have the following problem. I need to read data from a TXT file our company receives. I would use StreamReader, and process it line by line using ReadLine, however, the following problem...
10
3624
by: joelagnel | last post by:
hi friends, i've been having this confusion for about a year, i want to know the exact difference between text and binary files. using the fwrite function in c, i wrote 2 bytes of integers in...
4
34091
by: George | last post by:
Hi, I am puzzled by the following and seeking some assistance to help me understand what happened. I have very limited encoding knowledge. Our SAP system writes out a text file which includes...
5
2918
by: al jones | last post by:
I'll find an answer to this yet. I'm trying to read (streamreader and textfieldparser) data from a file which contains umlauted German characters and French with diacriticals. Both streamreader...
4
1986
by: Samuel | last post by:
Hi Currently text file that I create are UTF-8 encoded and I need ANSI encoding how can I do that Thank you, Samuel
0
7199
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7074
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7273
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7322
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6982
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7451
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5572
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5000
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.