473,387 Members | 1,641 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,387 software developers and data experts.

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:
<globalization requestEncoding="ISO-8859-2"
responseEncoding="ISO-8859-2" fileEncoding="iso-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(string 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 5607
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:
<globalization requestEncoding="ISO-8859-2"
responseEncoding="ISO-8859-2" fileEncoding="iso-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(string 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:
<globalization requestEncoding="ISO-8859-2"
responseEncoding="ISO-8859-2" fileEncoding="iso-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(string 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
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...
3
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...
0
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...
1
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...
1
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...
3
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...
7
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...
0
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...
2
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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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.