473,769 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with Polish accents with ASP.NET C#

Hello,

This problem is really driving me crazy ...

* I have a mySql database which is latin1_swedish_ ci

* In my web.config I have:
<globalizatio n requestEncoding ="ISO-8859-2"
responseEncodin g="ISO-8859-2" fileEncoding="i so-8859-2" culture="pl-PL"
uiCulture="pl-PL" />

* My page has: <meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-2" />

* And when I insert text in the database I have a replace like this:
private static string CodeAccents(str ing doReCode) {
string rt = doReCode;

// dutch
rt = rt.Replace("ê", "&ecirc;");
rt = rt.Replace("Ê", "&Ecirc;");
rt = rt.Replace("ë", "&euml;");
rt = rt.Replace("Ë", "&Euml;");

// french
rt = rt.Replace("é", "&eacute;") ;
rt = rt.Replace("É", "&Eacute;") ;
rt = rt.Replace("è", "&egrave;") ;
rt = rt.Replace("È", "&Egrave;") ;
rt = rt.Replace("ê", "&ecirc;");
rt = rt.Replace("Ê", "&Ecirc;");
rt = rt.Replace("á", "&aacute;") ;
rt = rt.Replace("Á", "&Aacute;") ;
rt = rt.Replace("à", "&agrave;") ;
rt = rt.Replace("À", "&Agrave;") ;
rt = rt.Replace("ä", "&auml;");
rt = rt.Replace("Ä", "&Auml;");

// polish
rt = rt.Replace("A", "&#260");
rt = rt.Replace("a", "&#261");
rt = rt.Replace("C", "&#262");
rt = rt.Replace("c", "&#263");
rt = rt.Replace("E", "&#280");
rt = rt.Replace("e", "&#281");
rt = rt.Replace("L", "&#321");
rt = rt.Replace("l", "&#322");
rt = rt.Replace("N", "&#323");
rt = rt.Replace("n", "&#324");
rt = rt.Replace("Ó", "&#211");
rt = rt.Replace("ó", "&#243");
rt = rt.Replace("S", "&#346");
rt = rt.Replace("s", "&#347");
rt = rt.Replace("Z", "&#377");
rt = rt.Replace("z", "&#378");
rt = rt.Replace("Z", "&#379");
rt = rt.Replace("z", "&#380");

return rt;
}

Now, when I for instance save this word: "Zdjecia"

And I return to the form it is saved like "Zdj & # 2 8 1 cia" (spaces
added for posting here)

But when I then save again and retur I get this: "Zdjecia" = "# 3 7
7 dje & # 2 6 3 i & # 2 6 1" (spaces added for posting here)

What am I doing wrong ???

Thanks !

Aug 28 '06 #1
2 5631
KJ
Looks like for the set of code below, the entities in the Polish
section lack a terminal semicolon. For example, you coded:

rt = rt.Replace("s", "&#347");

and it should be

rt = rt.Replace("s", "ś");

See the small difference ^^^

-KJ

AmigoFd wrote:
Hello,

This problem is really driving me crazy ...

* I have a mySql database which is latin1_swedish_ ci

* In my web.config I have:
<globalizatio n requestEncoding ="ISO-8859-2"
responseEncodin g="ISO-8859-2" fileEncoding="i so-8859-2" culture="pl-PL"
uiCulture="pl-PL" />

* My page has: <meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-2" />

* And when I insert text in the database I have a replace like this:
private static string CodeAccents(str ing doReCode) {
string rt = doReCode;

// dutch
rt = rt.Replace("ê", "&ecirc;");
rt = rt.Replace("Ê", "&Ecirc;");
rt = rt.Replace("ë", "&euml;");
rt = rt.Replace("Ë", "&Euml;");

// french
rt = rt.Replace("é", "&eacute;") ;
rt = rt.Replace("É", "&Eacute;") ;
rt = rt.Replace("è", "&egrave;") ;
rt = rt.Replace("È", "&Egrave;") ;
rt = rt.Replace("ê", "&ecirc;");
rt = rt.Replace("Ê", "&Ecirc;");
rt = rt.Replace("á", "&aacute;") ;
rt = rt.Replace("Á", "&Aacute;") ;
rt = rt.Replace("à", "&agrave;") ;
rt = rt.Replace("À", "&Agrave;") ;
rt = rt.Replace("ä", "&auml;");
rt = rt.Replace("Ä", "&Auml;");

// polish
rt = rt.Replace("A", "&#260");
rt = rt.Replace("a", "&#261");
rt = rt.Replace("C", "&#262");
rt = rt.Replace("c", "&#263");
rt = rt.Replace("E", "&#280");
rt = rt.Replace("e", "&#281");
rt = rt.Replace("L", "&#321");
rt = rt.Replace("l", "&#322");
rt = rt.Replace("N", "&#323");
rt = rt.Replace("n", "&#324");
rt = rt.Replace("Ó", "&#211");
rt = rt.Replace("ó", "&#243");
rt = rt.Replace("S", "&#346");
rt = rt.Replace("s", "&#347");
rt = rt.Replace("Z", "&#377");
rt = rt.Replace("z", "&#378");
rt = rt.Replace("Z", "&#379");
rt = rt.Replace("z", "&#380");

return rt;
}

Now, when I for instance save this word: "Zdjecia"

And I return to the form it is saved like "Zdj & # 2 8 1 cia" (spaces
added for posting here)

But when I then save again and retur I get this: "Zdjecia" = "# 3 7
7 dje & # 2 6 3 i & # 2 6 1" (spaces added for posting here)

What am I doing wrong ???

Thanks !
Aug 29 '06 #2
Problem found !!!

My code-page (.aspx) was saved as ANSI document and not as UTF-8 ! So
all my polish characters weren't saved at all, but were replaced by the
"normal" characters ... !

Have to check if that's a setting in dreamweaver ...
KJ schreef:
Looks like for the set of code below, the entities in the Polish
section lack a terminal semicolon. For example, you coded:

rt = rt.Replace("s", "&#347");

and it should be

rt = rt.Replace("s", "ś");

See the small difference ^^^

-KJ

AmigoFd wrote:
Hello,

This problem is really driving me crazy ...

* I have a mySql database which is latin1_swedish_ ci

* In my web.config I have:
<globalizatio n requestEncoding ="ISO-8859-2"
responseEncodin g="ISO-8859-2" fileEncoding="i so-8859-2" culture="pl-PL"
uiCulture="pl-PL" />

* My page has: <meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-2" />

* And when I insert text in the database I have a replace like this:
private static string CodeAccents(str ing doReCode) {
string rt = doReCode;

// dutch
rt = rt.Replace("ê", "&ecirc;");
rt = rt.Replace("Ê", "&Ecirc;");
rt = rt.Replace("ë", "&euml;");
rt = rt.Replace("Ë", "&Euml;");

// french
rt = rt.Replace("é", "&eacute;") ;
rt = rt.Replace("É", "&Eacute;") ;
rt = rt.Replace("è", "&egrave;") ;
rt = rt.Replace("È", "&Egrave;") ;
rt = rt.Replace("ê", "&ecirc;");
rt = rt.Replace("Ê", "&Ecirc;");
rt = rt.Replace("á", "&aacute;") ;
rt = rt.Replace("Á", "&Aacute;") ;
rt = rt.Replace("à", "&agrave;") ;
rt = rt.Replace("À", "&Agrave;") ;
rt = rt.Replace("ä", "&auml;");
rt = rt.Replace("Ä", "&Auml;");

// polish
rt = rt.Replace("A", "&#260");
rt = rt.Replace("a", "&#261");
rt = rt.Replace("C", "&#262");
rt = rt.Replace("c", "&#263");
rt = rt.Replace("E", "&#280");
rt = rt.Replace("e", "&#281");
rt = rt.Replace("L", "&#321");
rt = rt.Replace("l", "&#322");
rt = rt.Replace("N", "&#323");
rt = rt.Replace("n", "&#324");
rt = rt.Replace("Ó", "&#211");
rt = rt.Replace("ó", "&#243");
rt = rt.Replace("S", "&#346");
rt = rt.Replace("s", "&#347");
rt = rt.Replace("Z", "&#377");
rt = rt.Replace("z", "&#378");
rt = rt.Replace("Z", "&#379");
rt = rt.Replace("z", "&#380");

return rt;
}

Now, when I for instance save this word: "Zdjecia"

And I return to the form it is saved like "Zdj & # 2 8 1 cia" (spaces
added for posting here)

But when I then save again and retur I get this: "Zdjecia" = "# 3 7
7 dje & # 2 6 3 i & # 2 6 1" (spaces added for posting here)

What am I doing wrong ???

Thanks !
Aug 29 '06 #3

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

Similar topics

7
8801
by: Philip Kofoed | last post by:
Greetings, I have a SQL server 2000 running on an english win2000 workstation. In a database I have a table where one varchar column is set to polish collation. Regional settings for the system is polish. Data entered in a client application looks fine until they are posted. When reading the data with the client application, the special polish characters are incorrect, they appears as e.g. '1' and '3'. The strange thing is that when I...
3
23879
by: Stan | last post by:
Hallo, I have developed an application in MS Access 2000 (Polish version) under MS Windows XP prof (also Polish). Now I would like to run this code on MS Windows XP EN and MS Access XP EN. I have converted the mdb to version 2002 under MS Access XP Polish and under this version everything works OK. The problem starts when I copy the mdb file to Windows XP EN and start it with MS Access XP EN. I get following error: "The expression On...
0
1749
by: Wiktor Zychla | last post by:
in my application I sometimes use KeyPress event. in the event handler I have to check the char the user is trying to type. in NTs everything is correct. however on W98 I've noticed that the character given in e.KeyChar (e is KeyPressEventArgs of course) is NOT correctly converted ToString() when I type polish specific letters! instead of the letter 'polish l' I get '3', instead of 'polish z' I get '?'
1
1935
by: Ziemowit Skowronski | last post by:
Hi, I have a problem with displaying unicode strings in ASP.NET (C#). I recieve data from MS SQL Server database and use them to construct navigation on the page. Because I'm from Poland, I have to display Polish accent characters and here is a problem. On my testing/developing server (Windows 2003 Server) all works fine, but on production server (Windows 2000 Server) Polish accents are missing. Database collation is set to...
1
3058
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
5933
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"
7
3179
by: Piotr 'Zenobius' Baranowski | last post by:
Hello I'm using DB2 Express-C V9 with FixPack2 on CentOS. I have database created with territory PL. I'm using it with WebApplication written in PHP, the pages are encoded in UTF-8. I'm writing some data to XML, that contains polish characters. And that's where problem begins ;-) It's encoded with some crazy charset and products buggy chars.
0
1329
by: Piotrekk | last post by:
Hi I have a problem connected with DirectoryInfo class. My paths contain polish characters not present in english alphabet. Problem is that DirectoryInfo class displays them in a very bad way. I have tried to change project properties/ assembly information / neutral language to Polish but it didn't help. I would be grateful for any help.
2
6843
by: LittleLeopard | last post by:
Hi, I hope somebody can help me. I’m working on this website English/Portuguese and for example on this page http://www.goulartfilmes.com/en//IvyGoulart/tabid/54/Default.aspx we can see the Portuguese accents on the page without any problems, but if click on the pictures, where I have names in Portuguese with accents (example “The Curator” enlarged photos 3rd pic) Its html+flash+xml and it shows me the funny symbols. I've already checked the xml...
0
9423
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,...
1
9995
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
9863
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...
1
7410
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
6674
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
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3962
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
2
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
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.