diff options
author | Eduardo Julian | 2021-03-12 05:45:44 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-03-12 05:45:44 -0400 |
commit | dff34f01e838475b817803ec856661fe8940e5c0 (patch) | |
tree | d8ddb3b6fd5963fdbdda64a13f2a430242fd7b26 /stdlib/source/lux/data/text/encoding.lux | |
parent | 0c75fd67e3fcfbfb09d8c11b6cf396084ce40a15 (diff) |
Almost done with PHP.
Diffstat (limited to 'stdlib/source/lux/data/text/encoding.lux')
-rw-r--r-- | stdlib/source/lux/data/text/encoding.lux | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/stdlib/source/lux/data/text/encoding.lux b/stdlib/source/lux/data/text/encoding.lux index 88bbea138..4622c8be9 100644 --- a/stdlib/source/lux/data/text/encoding.lux +++ b/stdlib/source/lux/data/text/encoding.lux @@ -201,7 +201,11 @@ (bytes [] Binary)) (host.import: Array #as RubyArray - (pack [Text] RubyString)))} + (pack [Text] RubyString))) + + @.php + (as_is (host.import: (unpack [host.String host.String] Binary)) + (def: php_byte_array_format "C*"))} (as_is))) (def: (utf8\encode value) @@ -242,7 +246,10 @@ (|> value (:coerce RubyString) (RubyString::encode ["UTF-8"]) - (RubyString::bytes []))})) + (RubyString::bytes [])) + + @.php + (..unpack [..php_byte_array_format value])})) (def: (utf8\decode value) (-> Binary (Try Text)) @@ -278,6 +285,11 @@ (RubyArray::pack ["C*"]) (:coerce RubyString) (RubyString::force_encoding ["UTF-8"]) + #try.Success) + + @.php + (|> value + ("php pack" ..php_byte_array_format) #try.Success)}))) (structure: #export utf8 |