@lppedd/kotlinx-charset 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -5
- package/kotlinx-charset-exported.d.ts +2 -0
- package/kotlinx-charset-exported.mjs +1670 -1198
- package/kotlinx-charset-exported.mjs.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# kotlinx-charset
|
|
2
2
|
|
|
3
|
-

|
|
4
|
-

|
|
5
|
-

|
|
3
|
+
[](https://github.com/lppedd/kotlinx-charset/actions/workflows/build.yml)
|
|
4
|
+
[](./LICENSE)
|
|
5
|
+
[](https://kotlinlang.org)
|
|
6
|
+
[](https://mvnrepository.com/artifact/com.lppedd.kotlinx-charset)
|
|
7
|
+
[](https://www.npmjs.com/package/@lppedd/kotlinx-charset)
|
|
6
8
|
|
|
7
9
|
Minimal charset support for Kotlin Multiplatform.
|
|
8
10
|
|
|
@@ -12,7 +14,19 @@ See [CHANGELOG.md](./CHANGELOG.md).
|
|
|
12
14
|
|
|
13
15
|
### Supported Kotlin platforms
|
|
14
16
|
|
|
15
|
-
All Kotlin platforms are supported, except for Android.
|
|
17
|
+
All Kotlin platforms are supported, except for Android Native.
|
|
18
|
+
|
|
19
|
+
### Design considerations
|
|
20
|
+
|
|
21
|
+
**kotlinx-charset** aims to be straightforward for existing JDK consumers.
|
|
22
|
+
It replicates parts of the JDK's `Charset` API, albeit with more restrictions.
|
|
23
|
+
|
|
24
|
+
The core types you will work with are:
|
|
25
|
+
|
|
26
|
+
- `XCharset` - describes a character set
|
|
27
|
+
- `XCharsetDecoder` - decodes a byte sequence into characters
|
|
28
|
+
- `XCharsetEncoder` - encodes characters into a byte sequence
|
|
29
|
+
- `XCharsetRegistrar` - a registry and lookup service for obtaining `XCharset` instances
|
|
16
30
|
|
|
17
31
|
## core
|
|
18
32
|
|
|
@@ -27,7 +41,7 @@ private val registrar = XCharsetRegistrar()
|
|
|
27
41
|
registrar.registerCharset(YourCharset())
|
|
28
42
|
|
|
29
43
|
// Retrieve and use a charset
|
|
30
|
-
val charset = registrar.getCharset("
|
|
44
|
+
val charset = registrar.getCharset("YourCharsetName")
|
|
31
45
|
val decoder = charset.newDecoder()
|
|
32
46
|
val encoder = charset.newEncoder()
|
|
33
47
|
```
|
|
@@ -24,6 +24,8 @@ export declare interface XCharsetEncoder {
|
|
|
24
24
|
readonly "com.lppedd.kotlinx.charset.exported.XCharsetEncoder": unique symbol;
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
+
export declare function getCharsetOrNull(charsetName: string): Nullable<XCharset>;
|
|
27
28
|
export declare function getCharset(charsetName: string): XCharset;
|
|
29
|
+
export declare function getCharsets(): Array<XCharset>;
|
|
28
30
|
export declare function decode(charsetName: string, bytes: Uint8Array): string;
|
|
29
31
|
export declare function encode(charsetName: string, value: string): Uint8Array;
|