473,394 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Accent

Hi,

I have a txt file with some text I want to send via mail... The text
contains some words with accents... With my code, I receive the mail,
but letters with accent are missing :-(

What am I doing wrong ?

// Loading text file
private string MyBody(){
TextReader tr = new StreamReader(FilePath);
strBody = tr.ReadToEnd();
tr.Close();
}

//sending message
MailMessage _Mail = new MailMessage();
_Mail.To = m_strMailTo;
_Mail.Subject = "MyTest";
_Mail.From = m_strMailFrom;
_Mail.BodyEncoding = System.Text.Encoding.GetEncoding(1252);
_Mail.BodyFormat = MailFormat.Html;
_Mail.Priority = MailPriority.High;
_Mail.Body = m_MyBody() ;

TIA
Nov 16 '05 #1
6 3426


Franck Diastein wrote:

I have a txt file with some text I want to send via mail... The text
contains some words with accents... With my code, I receive the mail,
but letters with accent are missing :-(

What am I doing wrong ?

// Loading text file
private string MyBody(){
TextReader tr = new StreamReader(FilePath);


It could improve things if you specify the encoding as the second
argument to the StreamReader constructor, of course you need to know the
encoding the file has for that.


--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 16 '05 #2
OK, UTF7 did it :-)

Thanx

Martin Honnen wrote:


Franck Diastein wrote:

I have a txt file with some text I want to send via mail... The text
contains some words with accents... With my code, I receive the mail,
but letters with accent are missing :-(

What am I doing wrong ?

// Loading text file
private string MyBody(){
TextReader tr = new StreamReader(FilePath);

It could improve things if you specify the encoding as the second
argument to the StreamReader constructor, of course you need to know the
encoding the file has for that.

Nov 16 '05 #3
Ok, I got it, but I have a little problem... Until now I was handling
line carriage replacing \r\n with <br> with no problem in HTML email...

But how do I handle line carriages in plain text message ?

Thanx

Martin Honnen wrote:


Franck Diastein wrote:

I have a txt file with some text I want to send via mail... The text
contains some words with accents... With my code, I receive the mail,
but letters with accent are missing :-(

What am I doing wrong ?

// Loading text file
private string MyBody(){
TextReader tr = new StreamReader(FilePath);

It could improve things if you specify the encoding as the second
argument to the StreamReader constructor, of course you need to know the
encoding the file has for that.

Nov 16 '05 #4
You shouldn't need to handle anything in a plain text email.

Lowell

Franck Diastein wrote:
Ok, I got it, but I have a little problem... Until now I was handling
line carriage replacing \r\n with <br> with no problem in HTML email...

But how do I handle line carriages in plain text message ?

Thanx

Martin Honnen wrote:


Franck Diastein wrote:

I have a txt file with some text I want to send via mail... The text
contains some words with accents... With my code, I receive the mail,
but letters with accent are missing :-(

What am I doing wrong ?

// Loading text file
private string MyBody(){
TextReader tr = new StreamReader(FilePath);


It could improve things if you specify the encoding as the second
argument to the StreamReader constructor, of course you need to know
the encoding the file has for that.

Nov 16 '05 #5
Your accents may be extended ascii characters, which don't work too
well with HTML. I ran into this problem with characters 0x91 and
0x92, which are used in rich text.

I solved that problem by doing a string replacement of those
characters with their HTML hard-character equivalents. 0x91 would
then become ‘ and 0x92 would become ’.

-Mike

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 16 '05 #6
You're totally right !

Lowell Heddings wrote:
You shouldn't need to handle anything in a plain text email.

Lowell

Franck Diastein wrote:
Ok, I got it, but I have a little problem... Until now I was handling
line carriage replacing \r\n with <br> with no problem in HTML email...

But how do I handle line carriages in plain text message ?

Thanx

Martin Honnen wrote:


Franck Diastein wrote:
I have a txt file with some text I want to send via mail... The text
contains some words with accents... With my code, I receive the
mail, but letters with accent are missing :-(

What am I doing wrong ?

// Loading text file
private string MyBody(){
TextReader tr = new StreamReader(FilePath);


It could improve things if you specify the encoding as the second
argument to the StreamReader constructor, of course you need to know
the encoding the file has for that.

Nov 16 '05 #7

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

Similar topics

2
by: JB | last post by:
Hi, I'm having a problem with accent in PHP/HTML. I have a value stored in a table. The value is : é è à ù When I look directly into table via phpmyadmin, the value seems to be stored...
114
by: muldoon | last post by:
Americans consider having a "British accent" a sign of sophistication and high intelligence. Many companies hire salespersons from Britain to represent their products,etc. Question: When the...
3
by: Vittorio | last post by:
Hi, I have one problem ( I am a python beginner) in a cgi: print"""<a href="mailto:%s">""" %(campovalore.encode('iso-8859-1')) print campovalore.encode('iso-8859-1') print """</a>""" ...
3
by: Matthias HALDIMANN | last post by:
My SQL Server 2000 does not use the accent insensitive collation setting (collation containing _AI) in full-text serches: While SELECT * FROM <table> WHERE <column> LIKE '%a%' returns 'Mäuse',...
3
by: Darren Jensen | last post by:
Hi, Does anyone have a function which replaces accent chars from a string with the non-accented equivalent? For example 'hôpital' should return 'hopital'. Thank you in advance.
3
by: Daedalus.OS | last post by:
Hi, I've been asked to transfert a database from a webhoster to another. I think the database is on a windows box but I'm not 100% shure. The webhoster says it provides combined hosting on...
1
by: Fabrice | last post by:
Hello, I have encountered a deep problem with accent and I don't understand why. I m preparing a multi-language website. French and English so far. With french, we have accents and ......
0
by: Fabrice | last post by:
Hello, (Alain) Tis is a part of my code to retrieve text from hastable in memory cache, by reading (befor) a resources file. Thanks for your help. /1/ The resources file * I have create a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...

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.