Work in progress: add char_utf8bytes (#493)
* Add char_utf8bytes to library * Improved implementation * Improve code + add chars predicate * Update example * Renamed string_utf8bytes to char_utf8bytes
This commit is contained in:
15
src/prolog/examples/utf8.pl
Normal file
15
src/prolog/examples/utf8.pl
Normal file
@@ -0,0 +1,15 @@
|
||||
:- use_module(library(charsio)).
|
||||
:- use_module(library(lists)).
|
||||
|
||||
:- initialization(unit_test).
|
||||
|
||||
unit_test :-
|
||||
chars_utf8bytes("a£\x2124\", Bs),
|
||||
Bs = [97, 194, 163, 226, 132, 164].
|
||||
|
||||
write_f :-
|
||||
open('x.txt', write, Stream, [type(binary)]),
|
||||
F = put_byte(Stream),
|
||||
chars_utf8bytes("£\x2124\\x2764\\x1F496\\n", Bs),
|
||||
maplist(F, Bs),
|
||||
close(Stream).
|
||||
Reference in New Issue
Block a user