From 7da7c963aa7b01ed8256d143bd27872d1ecdf989 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 27 Apr 2019 21:35:04 -0400 Subject: Re-named "lux/tool/compiler/host" to "lux/target". --- stdlib/source/lux/data/text/encoding.lux | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 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 aae640382..470265081 100644 --- a/stdlib/source/lux/data/text/encoding.lux +++ b/stdlib/source/lux/data/text/encoding.lux @@ -1,5 +1,6 @@ (.module: [lux #* + ["@" target] [abstract [codec (#+ Codec)]] [data @@ -8,9 +9,6 @@ abstract] [world [binary (#+ Binary)]] - [tool - [compiler - ["_" host]]] [host (#+ import:)]]) ## https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html @@ -173,19 +171,30 @@ (|>> :representation)) ) -(`` (for {(~~ (static _.old)) +(`` (for {(~~ (static @.old)) + (as-is (import: #long java/lang/String + (new [(Array byte) java/lang/String]) + (getBytes [java/lang/String] (Array byte)))) + + (~~ (static @.jvm)) (as-is (import: #long java/lang/String (new [(Array byte) java/lang/String]) (getBytes [java/lang/String] (Array byte))))})) (def: #export (to-utf8 value) (-> Text Binary) - (`` (for {(~~ (static _.old)) + (`` (for {(~~ (static @.old)) + (java/lang/String::getBytes (..name ..utf-8) (:coerce java/lang/String value)) + + (~~ (static @.jvm)) (java/lang/String::getBytes (..name ..utf-8) (:coerce java/lang/String value))}))) (def: #export (from-utf8 value) (-> Binary (Error Text)) - (`` (for {(~~ (static _.old)) + (`` (for {(~~ (static @.old)) + (#error.Success (java/lang/String::new value (..name ..utf-8))) + + (~~ (static @.jvm)) (#error.Success (java/lang/String::new value (..name ..utf-8)))}))) (structure: #export UTF-8 (Codec Binary Text) -- cgit v1.2.3