Change wincharset selection method

Use utf-8 for java based phones
This commit is contained in:
stevenA 2022-01-17 10:43:50 +01:00
parent 5796297bae
commit 4e17791fa1
2 changed files with 10 additions and 3 deletions

View file

@ -1,7 +1,7 @@
<module> <module>
<rawname>sccp_manager</rawname> <rawname>sccp_manager</rawname>
<name>SCCP Manager</name> <name>SCCP Manager</name>
<version>14.4.0.2</version> <version>14.4.0.3</version>
<type>setup</type> <type>setup</type>
<category>SCCP Connectivity</category> <category>SCCP Connectivity</category>
<publisher>Steve Lad, Alex GP</publisher> <publisher>Steve Lad, Alex GP</publisher>
@ -39,6 +39,7 @@
* Version 14.3.0.31 * - Fix rewrite rules. * Version 14.3.0.31 * - Fix rewrite rules.
* Version 14.4.0.1 * - Modify installer to avoid data loss on existing 14.3 fields. Bump Minor version to reflect this. * Version 14.4.0.1 * - Modify installer to avoid data loss on existing 14.3 fields. Bump Minor version to reflect this.
* Version 14.4.0.2 * - Revert error in Installer db calls - IF EXISTS is not valid in MariaDb v5 (package DB) * Version 14.4.0.2 * - Revert error in Installer db calls - IF EXISTS is not valid in MariaDb v5 (package DB)
* Version 14.4.0.3 * - Change method of selecting phonecodepage depending on if is java phone.
</changelog> </changelog>
<location>https://github.com/chan-sccp/sccp_manager</location> <location>https://github.com/chan-sccp/sccp_manager</location>
<depends> <depends>

View file

@ -677,14 +677,20 @@ trait ajaxHelper {
} }
break; break;
case 'phonecodepage': case 'phonecodepage':
// phonecodepage depends on 2 variables - language and phone type (uses java or not).
// Non java phones use ISO8859-1 or CP1251 (Cyrillic); java phones use UTF-8. See @dkgroot.
// Below list is not definitive or necessarily accurate - needs to be maintained.
$nonJavaPhones = array(
'6901', '6911', '6921', '6945', '7902', '7905', '7910', '7911', '7912', '7914', '7915', '7916', '7920', '7925', '7926', '7931', '7935', '7936', '7937', '7940', '7960'
);
// TODO: May be other exceptions so use switch. Historically this is the only one handled // TODO: May be other exceptions so use switch. Historically this is the only one handled
if (!empty($get_settings["{$hdr_prefix}devlang"])) { if (!empty($get_settings["{$hdr_prefix}devlang"])) {
switch ($get_settings["{$hdr_prefix}devlang"]) { switch ($get_settings["{$hdr_prefix}devlang"]) {
case 'Russian_Russian_Federation': case 'Russian_Russian_Federation':
$value = 'CP1251'; $value = (in_array($get_settings['sccp_hw_type'], $nonJavaPhones, true)) ? 'CP1251' : 'utf-8';
break; break;
default: default:
$value = 'ISO8859-1'; $value = (in_array($get_settings['sccp_hw_type'], $nonJavaPhones, true)) ? 'ISO8859-1' : 'utf-8';
break; break;
} }
} }