The buildSelect function has a minor bug

Anything you want added or changed in future versions of ZoneMinder? Post here and there's a chance it will get in! Search to make sure it hasn't already been requested.
Post Reply
KorayPeksayar
Posts: 12
Joined: Fri Nov 11, 2005 11:35 pm
Location: Istanbul/Turkiye
Contact:

The buildSelect function has a minor bug

Post by KorayPeksayar »

Hello again,

The buildSelect function has a minor bug that prohibits translations to be displayed correctly:

Code: Select all

<option value="<?= $content_value ?>"<?php if ( $value == $content_value ) { echo " selected"; } ?>><?= htmlentities($content_text) ?></option>
line in zm_funcs.php formats the input from all db and translation entries to have proper HTML entities.

However, used with no parms forces the input to be in iso-8859-1 encoding only.

Instead I used:

Code: Select all

<option value="<?= $content_value ?>"<?php if ( $value == $content_value ) { echo " selected"; } ?>><?= htmlentities($content_text,ENT_QUOTES,$charset) ?></option>
which allows the code to convert both single and double quotes in $content_text to proper HTM entities and also be aware of the translation charset.

The variable $charset is in the zm_lang_tr_tr.php, which is the translation file for Turkish. I have also included these in the file's beginning:

Code: Select all

$charset="utf-8";
header( "Content-Type: text/html; $charset" );
setlocale( LC_ALL, "tr_TR.$charset" ); //All locale settings 4.3.0 and after
setlocale( LC_CTYPE, "tr_TR.$charset" ); //Character class settings 4.3.0 and after
setlocale( LC_TIME, "tr_TR.$charset" ); //Date and time formatting 4.3.0 and after
htmlentities() supports a couple of charsets so please check http://www.php.net/htmlentities for details.

Regards,
Koray
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Thanks. It may be worth keeping all of these issues in one thread so I can keep track of them. Otherwise some may be lost if they are just single posts that fade into the past. The htmlentities function is used in several places so it may be easier to just stick it inside a locale sensitive wrapper.

Phil
tkalfaoglu
Posts: 65
Joined: Wed Nov 22, 2006 6:19 am

Re: The buildSelect function has a minor bug

Post by tkalfaoglu »

Koray: Do you still have the Turkish translation of Zoneminder?
If so, could you upload it somewhere?

Thanks!
-turgut
Post Reply