osCommerce / oscommerce2

osCommerce Online Merchant v2.x
http://www.oscommerce.com
MIT License
281 stars 222 forks source link

Problem with html entities / UTF8 in language files #602

Open mgutt opened 6 years ago

mgutt commented 6 years ago

I'm working on the german language files of osC 2.3.4. As all files of osCommerce are using the UNIX/ANSI codepage I decided to replace all German Umlauts with their equivalent html entity eg. ü > ü.

This worked without problems, but now I found a problem. In admin/security_checks.php the title runs through tep_output_string_protected(): ' <td class="dataTableContent" valign="top" style="white-space: nowrap;">' . tep_output_string_protected($module['title']) . '</td>' . "\n" .

This means Version pr&uuml;fen becomes Version pr&amp;uuml;fen.

So you need to decide: a) change this line (and maybe others) if the string comes from the lang file. b) convert all language files to UTF8 codepage.

As some users overwrite the codepage with their text editor I prefer option a). This problem is for example viewable in many german translation packages.

Kymation commented 6 years ago

The ANSI/ISO 8859 character set was used by the long-obsolete osCommerce 2.2 versions and older. OsCommerce 2.3 and later all use UTF-8 encoding. Please use the correct encoding on your files.

mgutt commented 6 years ago

@Kymation Ok, then there is a bug in catalog/includes/languages/english/modules/payment/sofortueberweisung_direct.php because it's codepage is UNIX/ANSI(Windows) and its inconsistent because it contains ü and &uuml;: define('MODULE_PAYMENT_SOFORTUEBERWEISUNG_DIRECT_TEXT_DESCRIPTION', '....<i>Bei Benutzung dieses Links erh&auml;lt osCommerce f&uuml;r eine Neukundenvermittlung einen kleinen Bonus.</i>... define('MODULE_PAYMENT_SOFORTUEBERWEISUNG_DIRECT_TEXT_PUBLIC_TITLE', 'Sofortüberweisung');

And finally I'm still confused because the lang file is allowed to contain html tags <> and html entities like &nbsp; so why is tep_output_string_protected() used in admin/security_checks.php to filter a lang value?!

EDIT: Everything changed to UTF-8 in the german language pack and re-uploaded here: https://apps.oscommerce.com/BpubB&german-full-language-pack-for-2-3-4-in-u

There is still much work in the German Language files. Many typos, grammatical errors and inconsistent usage of words like "email, e-mail, E-Mail, Mail", etc. If I find the time I will update it again.