aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/data/text/encoding.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-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)