473,513 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to covert to UTF8

ad
I use a fileUpload of ASP.NET to read a csv file from client into a Strem
like:
Stream myStream = FileUpload1.FileContent;

But the file from Client if of CharSet BIG5.

How can I covert it to UTF8?
Jun 24 '06 #1
3 4032
> I use a fileUpload of ASP.NET to read a csv file from client into a Strem
like:
Stream myStream = FileUpload1.FileContent;

But the file from Client if of CharSet BIG5.

How can I covert it to UTF8?

Create encoding for Big5:
Encoding enc_in( 950 );
and use it with a StreamReader

For output use Encoding.UTF8 for the StreamWriter.
--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email
Jun 25 '06 #2
ad
Stream myStream = FileUpload1.FileContent;

But the file from Client if of CharSet BIG5.

How can I covert it to UTF8?

Create encoding for Big5:
Encoding enc_in( 950 );
and use it with a StreamReader

Hi,

How can I use " Encoding enc_in( 950 ) "

Could you give me an example.

Jun 25 '06 #3
> How can I use " Encoding enc_in( 950 ) "

Could you give me an example.


Encoding enci = Encoding.GetEncoding( 950 );
Encoding enco = Encoding.UTF8;

FileStream fsi = new FileStream("InFile", FileMode.Open, FileAccess.Read);
BufferedStream bsi = new BufferedStream(fsi);
StreamReader swi = new StreamReader(bsi, enci);

FileStream fso = new FileStream("OutFile", FileMode.Create,
FileAccess.Write);
BufferedStream bso = new BufferedStream(fso);
StreamWriter swo = new StreamWriter(bso, enco);

string buffer;
do {
buffer = swi.ReadLine();
if( buffer != null )
swo.WriteLine( buffer );
} while( buffer != null );

swo.Close();
swi.Close();

--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email
Jun 26 '06 #4

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

Similar topics

4
5034
by: sinasalek | last post by:
i have a problem with MySQL 4.1.x and UTF8. in version 4.0, i'm using html forms with utf8 charset for inserting unicode strings. but in version 4.1.x it is not working! if i change the charset of...
1
3952
by: ryang | last post by:
I am trying to understand how to work with Unicode in Perl. I have read the relevant man pages (perluniintro, perlunicode, etc.) and have written severl scripts to test/verifiy my understanding. ...
3
24547
by: Cindy Liu | last post by:
Hi Everyone, In .Net we have XmlSerializer to convert c# class to xml, or vice versa. Do we have any APIs to convert c# class to XSD? Thanks in advance, Cindy
13
2132
by: Ray Z | last post by:
So far, I get the idea that if I want to use both the unmanaged and managed memory, I can not avoid memory copy. But I DO need to avoid it. I get a idea that maybe I could use "union" to convert...
6
3672
by: Calros Lo | last post by:
Dear all: I develop a programe that need when I get a string , such as "123" or "ABC",if I get string "123" and the system will help me to create new string "124" , if I get string "ABC" and the...
6
5257
by: =?Utf-8?B?dmluY2VudA==?= | last post by:
Is there any method to covert a pdf file into jpg file in c#? Many thanks for your replying.
39
5825
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f...
0
7160
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
7537
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
7099
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
7525
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
5685
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
5086
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...
0
4746
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
799
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
456
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.