473,624 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

French charactor

Hello,

I want to read a text file which contains French charactor, then modify some of the
sentence, save it as a new text file.
But I found the new text file lost all the French charactors.
Anybody can help me?

Thanks,

Yongjian

My code:
StreamReader sr = new StreamReader(st Source,Encoding .UTF8);
StreamWriter sw = new StreamWriter(st Destination,fal se, Encoding.UTF8);

while ((stLine = sr.ReadLine())! =null)
{
// add something to the stLine, then write it to a new file

sw.WriteLine(st Line);
}
sr.Close();
sw.Close();

Nov 16 '05 #1
7 2355
Yongjian <Yo******@discu ssions.microsof t.com> wrote:
I want to read a text file which contains French charactor, then modify some of the
sentence, save it as a new text file.
But I found the new text file lost all the French charactors.
Anybody can help me?


Chances are you're just using the wrong encoding. Do you know for sure
what encoding your original file is in?

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
YJ
Thank you for yor replying.

I don't know the what encoding the original file is. I believe it should use default encoding. It looks like(it contains "é"):

Plan name: Régime de retraite des employés rémunérés Ã* l'heure de Les Poudres Métalliques du Québec Ltée.
Province of registration: QC
Registration number: 25803
Service end date: 31 May 2003
"Jon Skeet [C# MVP]" wrote:
Yongjian <Yo******@discu ssions.microsof t.com> wrote:
I want to read a text file which contains French charactor, then modify some of the
sentence, save it as a new text file.
But I found the new text file lost all the French charactors.
Anybody can help me?


Chances are you're just using the wrong encoding. Do you know for sure
what encoding your original file is in?

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #3
YJ <YJ@discussions .microsoft.com> wrote:
I don't know the what encoding the original file is. I believe it
should use default encoding. It looks like(it contains "?"):


Well, you can try using Encoding.Defaul t (which isn't the one used by
default, confusingly enough) but to be honest if you don't know the
encoding, there's no guarantee you'll get it right.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4
YJ wrote:
Thank you for yor replying.

I don't know the what encoding the original file is. I believe it
should use default encoding. It looks like(it contains "é"):


1. Run your favorite hex editor.
2. Compare non-ASCII characters' byte values with the code pages you find at
http://www.microsoft.com/globaldev/r...ce/cphome.mspx. Start with Windows
1252 (educated guess ;->).

Cheers,

--
Joerg Jooss
jo*********@gmx .net

Nov 16 '05 #5
Hi ,

I used "Request.Pa rams["sName"]" on the Page_Load event.

I could not read the French like "é" If the sName has French, ie. if I pass the url like "webFom1?sName= 'abé'", then the Request.Params["sName"]"will equal to "ab", the "é" get choped.,
What should I do?

I used System.text; and set Request.content Encoding =encoding.defau lt or Request.content Encoding =encoding.utf-7, none of them works.

Thanks, Jasmine

"Jon Skeet [C# MVP]" wrote:
YJ <YJ@discussions .microsoft.com> wrote:
I don't know the what encoding the original file is. I believe it
should use default encoding. It looks like(it contains "?"):


Well, you can try using Encoding.Defaul t (which isn't the one used by
default, confusingly enough) but to be honest if you don't know the
encoding, there's no guarantee you'll get it right.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #6
Hi ,

I used "Request.Pa rams["sName"]" on the Page_Load event.

I could not read the French like "é" If the sName has French, ie. if I pass the url like "webFom1?sName= 'abé'", then the Request.Params["sName"]"will equal to "ab", the "é" get choped.,
What should I do?

I used System.text; and set Request.content Encoding =encoding.defau lt or Request.content Encoding =encoding.utf-7, none of them works.

Thanks, Jasmine

"Jon Skeet [C# MVP]" wrote:
YJ <YJ@discussions .microsoft.com> wrote:
I don't know the what encoding the original file is. I believe it
should use default encoding. It looks like(it contains "?"):


Well, you can try using Encoding.Defaul t (which isn't the one used by
default, confusingly enough) but to be honest if you don't know the
encoding, there's no guarantee you'll get it right.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #7
Jasmine <Ja*****@discus sions.microsoft .com> wrote:
I used "Request.Pa rams["sName"]" on the Page_Load event.

I could not read the French like "?" If the sName has French, ie. if
I pass the url like "webFom1?sName= 'ab?'", then the
Request.Params["sName"]"will equal to "ab", the "?" get choped.,
What should I do?


You should avoid passing things in the URL, to start with. URL content
encoding is a murky business, from what I remember. If you make the
request a POST rather than a GET, and put the data in the content
rather than the URL, you're more likely to get something useful.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #8

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

Similar topics

2
3169
by: Alex Shi | last post by:
In php, is there a way obtain the width of a charactor of a certain font? Alex -- ================================================== Cell Phone Batteries at 30-50%+ off retail prices! http://www.pocellular.com ==================================================
3
3547
by: Salgoud Dell | last post by:
I have a VB6 application running on a French computer using Windows ME. The app doesn't work the same way as it does when running on an English Windows OS. The main issue I have, that I can't seem to overcome, is that the english text font size my program thinks is available doesn't seem to be there. Although a line of text printed on a US Windows machine looks fine, when it is printed from this French computer the tabs are over written...
1
1945
by: Pater Maximus | last post by:
I want to use the MS Word spell checker from my Python program. I check the spelling a word at a time. It works fine for English but I can not force it to use French when I am using that language. The French spell checking works find when done directly in the Word window. I have the automatic language detection turned off, the language set to French, and keyboard set to French
38
5725
by: Haines Brown | last post by:
I'm having trouble finding the character entity for the French abbreviation for "number" (capital N followed by a small supercript o, period). My references are not listing it. Where would I find an answer to this question (don't find it in the W3C_char_entities document). -- Haines Brown brownh@hartford-hwp.com
6
1641
by: Francois Suter | last post by:
To all French speakers on the list, I am pleased to announce the start of a PostgreSQL general mailing list in French. Its name is pgsql-fr-generale. I hope many of you will join it so that we can make it an interesting place. Ever since Justin "promoted" me to French advocacy contact I received several requests for information from people who were obviously quite ill at ease with English. I suppose this list could be a boon to...
1
1408
by: sandipvdhande | last post by:
I have problem in printinh the extended ascii charactors to file in C.Please tell me the solution for this issue .Is there any function to convert the charactor ..or is there any function to change the charactor set in C
1
3046
by: bssjohn | last post by:
Dear All, I have developing a French website using PHP & Ajax. In that I tried to display some French texts from mysql database using Ajax. Form local I got the text from db with Correct accents but in online French accents are missing. The text displays like this “de r?isation pour regroup?a majorit?es “. I declared following code in the head section of the file. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
3
5916
by: bss | last post by:
Dear All, I have developing a French website using PHP & Ajax. In that I tried to display some French texts from mysql database using Ajax. Form local I got the text from db with Correct accents but in online French accents are missing. The text displays like this "de r?isation pour regroup?a majorit?es ". I declared following code in the head section of the file. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
1304
by: Kerem Gümrükcü | last post by:
Hi, does anbody know when the VS 2008 will be available "en francais", in french. I also would take a french trial if available. Great would be a Team Suite as a trial. I have some fellow developers who prefer the french language and sometimes i had to do the same, when its time to meet our partners from france. We also want to see what the "big-brother" can do for us, so first we want to explore the trial before we have to decide what...
0
8234
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8172
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8620
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6110
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5563
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4079
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.