From 7fbe736ce2e4d159afd3c85eb790dae9b6155f73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sat, 7 Oct 2017 00:50:59 +0200 Subject: [PATCH] fix charset parsing code to work with new format in back-end sources --- base.php | 11 ++++++++++- pages/help/charsets.php | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/base.php b/base.php index 57ce7fb..d62edbe 100644 --- a/base.php +++ b/base.php @@ -173,9 +173,18 @@ if (!function_exists('load_esp_charsets')) { $rows = array_map('trim', $rows); foreach($rows as $j => $v) { + $literal = false; if (strpos($v, '0x') === 0) { + // hexa codes $v = substr($v, 2); $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 { $v = intval($v); } @@ -183,7 +192,7 @@ if (!function_exists('load_esp_charsets')) { $table[] = [ $ascii, chr($ascii), - utf8($v==0? $ascii :$v), + $literal ? $v : utf8($v==0? $ascii :$v), ]; } $cps[$name] = $table; diff --git a/pages/help/charsets.php b/pages/help/charsets.php index 961eda6..da28fa1 100644 --- a/pages/help/charsets.php +++ b/pages/help/charsets.php @@ -21,6 +21,8 @@
  • `A` - UK ASCII: # replaced with £
  • `0` - Symbols and basic line drawing (standard DEC alternate character set)
  • `1` - Symbols and advanced line drawing (based on DOS codepage 437, ESPTerm specific)
  • +
  • `2` - Block characters and thick line drawing (ESPTerm specific)
  • +
  • `3` - Extra line drawing (ESPTerm specific)