473,587 Members | 2,412 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.Fil eContent;

But the file from Client if of CharSet BIG5.

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

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.Fil eContent;

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.GetEnc oding( 950 );
Encoding enco = Encoding.UTF8;

FileStream fsi = new FileStream("InF ile", FileMode.Open, FileAccess.Read );
BufferedStream bsi = new BufferedStream( fsi);
StreamReader swi = new StreamReader(bs i, enci);

FileStream fso = new FileStream("Out File", FileMode.Create ,
FileAccess.Writ e);
BufferedStream bso = new BufferedStream( fso);
StreamWriter swo = new StreamWriter(bs o, 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
5039
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 column, ALTER TABLE `icons` CHANGE `name_farsi` `name_farsi` VARCHAR( 99 ) CHARACTER SET utf8 COLLATE utf8_persian_ci DEFAULT NULL and change...
1
3960
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. However, I created a script that has unexpected output. The script is below and it contains some UTF-8 encoded characters which represent all five...
3
24573
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
2148
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 byte to int and so on. Here is my source code, I wonder if this will work with GC? struct MyUnion {
6
3681
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 system will help me to create new string "ABD" , could somebody can help me how to programe it , thank you very much. I don't know to how to...
6
5265
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
5842
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 ISO-8859-1 -t UTF-8 mydb.sql mydb_utf8.sql mysqlCREATE DATABASE mydb_utf8 CHARACTER SET utf8 COLLATE utf8_general_ci;
0
7918
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7843
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7967
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5392
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3875
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2353
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1452
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.