From dff34f01e838475b817803ec856661fe8940e5c0 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 12 Mar 2021 05:45:44 -0400 Subject: Almost done with PHP. --- stdlib/source/lux/data/text/encoding.lux | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'stdlib/source/lux/data/text/encoding.lux') 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 -- cgit v1.2.3