diff options
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 |