fix charset parsing code to work with new format in back-end sources

pull/1/head
Ondřej Hruška 7 years ago
parent d4931c1f31
commit 7fbe736ce2
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 11
      base.php
  2. 2
      pages/help/charsets.php

@ -173,9 +173,18 @@ if (!function_exists('load_esp_charsets')) {
$rows = array_map('trim', $rows); $rows = array_map('trim', $rows);
foreach($rows as $j => $v) { foreach($rows as $j => $v) {
$literal = false;
if (strpos($v, '0x') === 0) { if (strpos($v, '0x') === 0) {
// hexa codes
$v = substr($v, 2); $v = substr($v, 2);
$v = hexdec($v); $v = hexdec($v);
} else if (strpos($v, 'u\'\\0\'') === 0) {
// zero
$v = 0;
} else if (strpos($v, 'u\'') === 0) {
// utf8 literals
$v = mb_substr($v, 2, 1, 'utf-8');
$literal = true;
} else { } else {
$v = intval($v); $v = intval($v);
} }
@ -183,7 +192,7 @@ if (!function_exists('load_esp_charsets')) {
$table[] = [ $table[] = [
$ascii, $ascii,
chr($ascii), chr($ascii),
utf8($v==0? $ascii :$v), $literal ? $v : utf8($v==0? $ascii :$v),
]; ];
} }
$cps[$name] = $table; $cps[$name] = $table;

@ -21,6 +21,8 @@
<li>`A` - UK ASCII: # replaced with £</li> <li>`A` - UK ASCII: # replaced with £</li>
<li>`0` - Symbols and basic line drawing (standard DEC alternate character set)</li> <li>`0` - Symbols and basic line drawing (standard DEC alternate character set)</li>
<li>`1` - Symbols and advanced line drawing (based on DOS codepage 437, ESPTerm specific)</li> <li>`1` - Symbols and advanced line drawing (based on DOS codepage 437, ESPTerm specific)</li>
<li>`2` - Block characters and thick line drawing (ESPTerm specific)</li>
<li>`3` - Extra line drawing (ESPTerm specific)</li>
</ul> </ul>
<p> <p>

Loading…
Cancel
Save