aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/data/text/encoding.lux
diff options
context:
space:
mode:
authorEduardo Julian2019-04-27 21:35:04 -0400
committerEduardo Julian2019-04-27 21:35:04 -0400
commit7da7c963aa7b01ed8256d143bd27872d1ecdf989 (patch)
treefecabe17a077a2bd87096522e94e46e68a24f936 /stdlib/source/lux/data/text/encoding.lux
parentdbd1e0a849f3d3e7037d3d651e7b626a7fc49fad (diff)
Re-named "lux/tool/compiler/host" to "lux/target".
Diffstat (limited to 'stdlib/source/lux/data/text/encoding.lux')
-rw-r--r--stdlib/source/lux/data/text/encoding.lux21
1 files changed, 15 insertions, 6 deletions
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)