472,331 Members | 1,802 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,331 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 5544
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...
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...
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...
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...
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...
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...
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...
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...
2
by: LittleLeopard | last post by:
Hi, I hope somebody can help me. Im working on this website English/Portuguese and for example on this page...
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.