473,761 Members | 9,864 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to send mail bodies with german umlauts using System.Net.Mail ?

Hello,

I'm using VS 2005 and I need to send a mail body which contains german
umlauts (ä,ö,ü).

When I receive the mail in Outlook 2003 (english operating system) I always
get a '|' or other similar symbols instead of the expected umlaut.

I'm using Sstem.Net.Mail and I already tried something like this:
string body = "this is some sample äöüÄÖÜß HTML text";

System.Net.Mail .AlternateView htmlView =
System.Net.Mail .AlternateView. CreateAlternate ViewFromString( body,
Encoding.Unicod e, "text/html");

mail.AlternateV iews.Add(htmlVi ew);

and also this:

string body = "this is some sample äöüÄÖÜß HTML text";

System.Net.Mail .AlternateView htmlView =
System.Net.Mail .AlternateView. CreateAlternate ViewFromString( body,
Encoding.GetEnc oding("iso-8859-1"), "text/html");

mail.AlternateV iews.Add(htmlVi ew);

In both cases I receive the wrong message body without the umlauts.

What am I doing wrong? Am I missing something?

Many thanks in advance,

Roberto Rocco.


Nov 27 '06 #1
1 3977
Hi Roberto,

Using MailMessage use the properties BodyEncoding and SubjectEndocing (2.0
only).

On Mon, 27 Nov 2006 22:19:31 +0100, Roberto Rocco
<ro***********@ atoll.bizwrote:
Hello,

I'm using VS 2005 and I need to send a mail body which contains german
umlauts (ä,ö,ü).

When I receive the mail in Outlook 2003 (english operating system) I
always
get a '|' or other similar symbols instead of the expected umlaut.

I'm using Sstem.Net.Mail and I already tried something like this:
string body = "this is some sample äöüÄÖÜß HTML text";

System.Net.Mail .AlternateView htmlView =
System.Net.Mail .AlternateView. CreateAlternate ViewFromString( body,
Encoding.Unicod e, "text/html");

mail.AlternateV iews.Add(htmlVi ew);

and also this:

string body = "this is some sample äöüÄÖÜß HTML text";

System.Net.Mail .AlternateView htmlView =
System.Net.Mail .AlternateView. CreateAlternate ViewFromString( body,
Encoding.GetEnc oding("iso-8859-1"), "text/html");

mail.AlternateV iews.Add(htmlVi ew);

In both cases I receive the wrong message body without the umlauts.

What am I doing wrong? Am I missing something?

Many thanks in advance,

Roberto Rocco.



--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 28 '06 #2

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

Similar topics

13
8527
by: Robert Zierhofer | last post by:
Hi all, I currently face a problem with htmlentities and german "umlaute". After moving my scripts to a new box (from Linux to FreeBSD) I had to see that htmlentities is not working anymore. The BSD Server (FreeBSD 5.1.2) runs PHP 4.3.9 and Apache 2 as well as the Linux Server does/did too. I also tried defining the charset with ISO 8859-1 as 3rd parameter in htmlentities but without a result.
0
3277
by: Bjoern Obermeyer | last post by:
Hi, I would like to use a regular expression like "\\w+" to extract the values "red" "green" and "blue" from the expression "red;green;blue". That works fine just until a german umlaut like "ü" is in the expression. Is there a possibility to make the java.util.regex.Matcher work properly with german umlauts? I read something about encoding in the documentation - perhaps I did not try out the right option...
4
4300
by: Joerg Lehmann | last post by:
I am using Python 2.2.3 (Fedora Core 1). The problem is, that strings containing umlauts do not work as I would expect. Here is my example: >>> a = 'äöü' >>> b = '123' >>> print "%-5s %-5s\n%-5s %-5s" % (a,a,b,b) äöü äöü 123 123 I would expect, that the displayed width of a or b is the same: 5 characters.
6
5623
by: peter pilsl | last post by:
postgres 7.3.2 I store unicode-data in postgresql. The data is retrieved via webinterfaces, processed with perl and then stored in postgresql (and viceversa). All is going nice with one problem. If performing a "select * order by field"-query the result is not what I expected. German umlauts (ie: Ö) are stored as doublechars ("Ö" is "Ö") and only the first char seems to be taken into account when sorting.
6
3260
by: John J. Hughes II | last post by:
I have a service that needs to send e-mail alerts. I have been attempting to use the System.Net.Mail function from .NET but this seems to require the IIS be installed and running. Since some of my customers are not really happy with having the IIS installed, not being used except to send e-mail this is becoming a problem. I have also tried using a little program from code project for sending e-mail which works great on older servers...
0
2110
by: Markus Wollny | last post by:
Hi! Sorry to bother you, but I just don't know how to get tsearch2 configured correctly for my setup. I've got a 7.4.3 database-cluster initdb'ed with de_DE@euro as locale, the database is with Unicode encoding. I made and installed contrib/tsearch2 after installing the dump/reload-patch http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/regprocedure_7.4.patch.gz as advised by the docs. So far everything is looking good, I have...
8
8851
by: DierkErdmann | last post by:
Hi ! I know that this topic has been discussed in the past, but I could not find a working solution for my problem: sorting (lists of) strings containing special characters like "ä", "ü",... (german umlaute). Consider the following list: l = For sorting the letter "Ä" is supposed to be treated like "Ae", therefore sorting this list should yield
10
5571
by: Martin | last post by:
Hi all, When a user enters a german character in a textbox (such as ö ä ü ß) and I try to save it, these characters get converted to a different character. How can I prevent this? Tia, Martin
12
8051
by: Uwe Braunholz | last post by:
Hello, working on a asp.net Website brought me to a strange problem. I want to enable my users to pass a search string via the query string of an url. It works if the user calls the URL like "default.aspx?search=mystring" But as soon as a German umlaut is in the query string it does not handle the char correctly (like "default.aspx?search=müstring" will be
0
9345
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
10115
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9905
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9775
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8780
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6609
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
5229
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...
3
3456
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2752
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.