Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
da-liii committed Oct 11, 2024
1 parent 9d7be18 commit 0cab3a9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion TeXmacs/tests/66_13.scm
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,21 @@
(check (utf8->herk (string #\xFF)) => "<#FF>")
)

(define (test-herk-others)
(check (utf8->herk "<less>") => "<less>")
(check (herk->utf8 "<less>") => "<less>")
(check (utf8->herk "<gtr>") => "<gtr>")
(check (herk->utf8 "<gtr>") => "<gtr>")

(check (utf8->herk "<#00FF>") => "<#00FF>")
(check (utf8->herk "<#0FF>") => "<#0FF>")
(check (utf8->herk "<#FF>") => "<#FF>")
(check (herk->utf8 "<#FF>") => "ÿ")
(check (herk->utf8 "<#0FF>") => "ÿ")
(check (herk->utf8 "<#00FF>") => "ÿ")

(check (herk->utf8 "<#4E2D>") => ""))

(define (test-herk)
(test-herk-0x)
(test-herk-1x)
Expand All @@ -368,7 +383,8 @@
(test-herk-Cx)
(test-herk-Dx)
(test-herk-Ex)
(test-herk-Fx))
(test-herk-Fx)
(test-herk-others))

(tm-define (test_66_13)
(test-herk)
Expand Down
2 changes: 1 addition & 1 deletion src/Data/String/converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ utf8_to_herk (string input) {
string output;
for (i= 0; i < n;) {
start = i;
unsigned int code= decode_from_utf8 (input, i);
uint32_t code= decode_from_utf8 (input, i);
string s = input (start, i);
string r = apply (conv, s);
if (r == s && (code < 32 || code >= 128)) r= "<#" * to_Hex (code) * ">";
Expand Down

0 comments on commit 0cab3a9

Please sign in to comment.