Usernames get wrong encoding (Lithuanian language)

18 years 2 months ago #3019 by matik71
Almost in every non-english language are found umlaut letters with special marks,also in charset ISO 8859-2.
Many thanks for this discussion on this forum especially for feddyups and elesus.

Martin
HOSTING/Domains/Translators
www.en.winder.pl

Please Log in to join the conversation.

18 years 2 months ago #3032 by registoni
I have solved my problem wiht displaying cyrilic character (win-1251 charset)
Here is what I did (thnx to all for help):
CB RC2 non-UTF charset fix:

1. REPLACE all occurences of htmlentities with htmlspecialchars in the following files:

components/com_comprofiler/plugin/user/plug_cbcore/cb.core.php and
components/com_comprofiler/plugin/user/plug_cbconnections/cb.connections.php

2. replace the first two lines of the function unhtmlentities in the file administrator/components/com_comprofiler/comprofiler.class.php at around line 1420 with the following code:

[code:1]function unhtmlentities ($string, $quotes, $charset) {

if ((phpversion() < '5.0.0') && ((phpversion() < '4.3.0') || !((strncmp($charset,"ISO-8859",8)==0) || ereg("1251",$charset) ||ereg("1252",$charset)))) {[/code:1]
the rest of the function is unchanged

3. Change htmlentities function into htmlspecialchars in the same file (comprofiler.class.php) at line 1250

instead of:
[code:1]$oReturn = htmlentities($oValue); //htmlentities(str_replace("&quot;",'"',$oValue)); // corrects double-escapings of " in mysql_escape_string used in j! db.[/code:1]
put:
[code:1]$oReturn = htmlspecialchars($oValue);[/code:1]

4. Replace the following piace of code in the file components/com_comprofiler/comprofiler.php on line 1357 in the addConnection method:
[code:1].addslashes(htmlentities($cbCon->getUserMSG())).[/code:1]

with:

[code:1].$cbCon->getUserMSG().[/code:1]

5. Replace the code near the line 68 in the modules/mod_cbloginrc2.php file:

[code:1]if ( $name ) {

$query = "SELECT name FROM #__users WHERE id = ". $my->id;

$database->setQuery( $query );

$name = htmlentities($database->loadResult());

} else {

$name = htmlentities($my->username);

}[/code:1]



with:

[code:1]if ( $name ) {

$query = "SELECT name FROM #__users WHERE id = ". $my->id;

$database->setQuery( $query );

$name = htmlspecialchars($database->loadResult());

} else {

$name = htmlentities($my->username);

}[/code:1]

Please Log in to join the conversation.

17 years 11 months ago #10429 by danijel
hmmm...

i have gone thru this instructions, but since I don't have a clue what I'm doing It doesn't work like i would want. Of course. :blink:

1.
I don't actually understand why tweaking unhtmlentities function does anything? It is not used anywhere in comprofiler (have done search)??
Php version of my host is 4.3.11 - Do I even need to change this function.

Slovene characters are in iso-8859-2. should the second step be therefore any different than
[code:1] if ((phpversion() < '5.0.0') && ((phpversion() < '4.3.0') || !((strncmp($charset,"ISO-8859",8)==0) || ereg("1250",$charset)))) {
[/code:1]

2.
I actually managed to imput our čšž chars in database and EVEN read them correctly from comprofiler. BUT the problem is, that I would want to have these characters posted corectly in db aswell (since I want to edit db externally) - is it even possible?

Thanks for help!

Post edited by: danijel, at: 2006/04/16 17:41

Please Log in to join the conversation.

17 years 10 months ago #11546 by GardE


Post edited by: GardE, at: 2006/05/04 15:09

Please Log in to join the conversation.

17 years 10 months ago #11547 by GardE
How about this??
Attachments:

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.199 seconds

Facebook Twitter LinkedIn