expo-gbk-converter 1.0.0

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.
Files changed (135) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +115 -0
  3. package/android/build/.transforms/fb7e4be3bf3f04a3be973ebd3489d8b5/results.bin +1 -0
  4. package/android/build/.transforms/fb7e4be3bf3f04a3be973ebd3489d8b5/transformed/classes/classes_dex/classes.dex +0 -0
  5. package/android/build/generated/source/buildConfig/debug/expo/modules/gbkconverter/BuildConfig.java +10 -0
  6. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +7 -0
  7. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
  8. package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +6 -0
  9. package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
  10. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  11. package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
  12. package/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +0 -0
  13. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -0
  14. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
  15. package/android/build/intermediates/incremental/mergeDebugAssets/merger.xml +2 -0
  16. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
  17. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
  18. package/android/build/intermediates/java_res/debug/processDebugJavaRes/out/META-INF/expo-gbk-converter_debug.kotlin_module +0 -0
  19. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/expo/modules/gbkconverter/BuildConfig.class +0 -0
  20. package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +2 -0
  21. package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +7 -0
  22. package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +7 -0
  23. package/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +1 -0
  24. package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
  25. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  26. package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +1 -0
  27. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  28. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
  29. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
  30. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
  31. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  32. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
  33. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
  34. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  35. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  36. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  37. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  38. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  39. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  40. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
  41. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  42. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  43. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  44. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  45. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  46. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  47. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
  48. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  49. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  50. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  51. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  52. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  53. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  54. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
  55. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  56. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  57. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  58. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  59. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  60. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  61. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
  62. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  63. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
  64. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
  65. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
  66. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  67. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
  68. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
  69. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  70. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  71. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  72. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
  73. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  74. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
  75. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
  76. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  77. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  78. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  79. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
  80. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  81. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  82. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
  83. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +2 -0
  84. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  85. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
  86. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
  87. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
  88. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  89. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
  90. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
  91. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  92. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  93. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  94. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  95. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  96. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
  97. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  98. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  99. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  100. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  101. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  102. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  103. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
  104. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  105. package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
  106. package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  107. package/android/build/outputs/logs/manifest-merger-debug-report.txt +14 -0
  108. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  109. package/android/build/tmp/kotlin-classes/debug/META-INF/expo-gbk-converter_debug.kotlin_module +0 -0
  110. package/android/build/tmp/kotlin-classes/debug/expo/modules/gbkconverter/ExpoGbkConverterModule$definition$lambda$1$$inlined$AsyncFunction$1.class +0 -0
  111. package/android/build/tmp/kotlin-classes/debug/expo/modules/gbkconverter/ExpoGbkConverterModule$definition$lambda$1$$inlined$AsyncFunction$2.class +0 -0
  112. package/android/build/tmp/kotlin-classes/debug/expo/modules/gbkconverter/ExpoGbkConverterModule$definition$lambda$1$$inlined$AsyncFunction$3.class +0 -0
  113. package/android/build/tmp/kotlin-classes/debug/expo/modules/gbkconverter/ExpoGbkConverterModule.class +0 -0
  114. package/android/build.gradle +43 -0
  115. package/android/src/main/AndroidManifest.xml +2 -0
  116. package/android/src/main/java/expo/modules/gbkconverter/ExpoGbkConverterModule.kt +17 -0
  117. package/app.plugin.js +3 -0
  118. package/build/index.d.ts +2 -0
  119. package/build/index.d.ts.map +1 -0
  120. package/build/index.js +11 -0
  121. package/build/index.js.map +1 -0
  122. package/build/src/ExpoGbkConverterModule.d.ts +3 -0
  123. package/build/src/ExpoGbkConverterModule.d.ts.map +1 -0
  124. package/build/src/ExpoGbkConverterModule.js +5 -0
  125. package/build/src/ExpoGbkConverterModule.js.map +1 -0
  126. package/build/src/ExpoGbkConverterModule.web.d.ts +5 -0
  127. package/build/src/ExpoGbkConverterModule.web.d.ts.map +1 -0
  128. package/build/src/ExpoGbkConverterModule.web.js +8 -0
  129. package/build/src/ExpoGbkConverterModule.web.js.map +1 -0
  130. package/expo-module.config.json +9 -0
  131. package/ios/ExpoGbkConverter.podspec +24 -0
  132. package/ios/ExpoGbkConverterModule.swift +26 -0
  133. package/package.json +47 -0
  134. package/src/ExpoGbkConverterModule.ts +3 -0
  135. package/src/ExpoGbkConverterModule.web.ts +5 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Evan Sun
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # expo-gbk-converter
2
+
3
+ An Expo native module to decode GBK/GB18030 encoded text from base64 strings. This is particularly useful for parsing Chinese encoded files (like CSV exports from Alipay, WeChat, etc.) in React Native/Expo applications.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npx expo install expo-gbk-converter
9
+ ```
10
+
11
+ Or using npm/yarn:
12
+
13
+ ```bash
14
+ npm install expo-gbk-converter
15
+ # or
16
+ yarn add expo-gbk-converter
17
+ ```
18
+
19
+ ## Requirements
20
+
21
+ - Expo SDK 51+
22
+ - iOS 15.1+
23
+ - Android minSdkVersion 24+
24
+
25
+ ## Usage
26
+
27
+ ```typescript
28
+ import { decodeGBK } from 'expo-gbk-converter';
29
+ import * as FileSystem from 'expo-file-system';
30
+
31
+ // Read a GBK encoded file as base64
32
+ const base64Content = await FileSystem.readAsStringAsync(fileUri, {
33
+ encoding: FileSystem.EncodingType.Base64,
34
+ });
35
+
36
+ // Decode GBK to UTF-8 string
37
+ const utf8Text = await decodeGBK(base64Content);
38
+
39
+ console.log(utf8Text); // Now you have the readable Chinese text
40
+ ```
41
+
42
+ ## API
43
+
44
+ ### `decodeGBK(base64: string): Promise<string>`
45
+
46
+ Decodes a GBK/GB18030 encoded base64 string to UTF-8 text.
47
+
48
+ **Parameters:**
49
+
50
+ - `base64` (string): Base64 encoded string of GBK/GB18030 data
51
+
52
+ **Returns:**
53
+
54
+ - `Promise<string>`: Decoded UTF-8 text
55
+
56
+ **Throws:**
57
+
58
+ - Error if the base64 string is invalid
59
+ - Error if the data cannot be decoded as GBK/GB18030
60
+
61
+ ## Platform Support
62
+
63
+ | Platform | Support |
64
+ | -------- | ------- |
65
+ | iOS | ✅ |
66
+ | Android | ✅ |
67
+ | Web | ❌ |
68
+
69
+ > Note: Web platform is not supported because browsers don't have native GBK decoding support. Consider using a JavaScript-based decoder like `iconv-lite` for web.
70
+
71
+ ## Use Cases
72
+
73
+ - Parsing Alipay (支付宝) bill exports
74
+ - Reading legacy Chinese encoded files
75
+ - Processing CSV files with GBK encoding
76
+
77
+ ## Example: Parsing Alipay Bills
78
+
79
+ ```typescript
80
+ import { decodeGBK } from 'expo-gbk-converter';
81
+ import * as FileSystem from 'expo-file-system';
82
+ import Papa from 'papaparse';
83
+
84
+ async function parseAlipayBill(fileUri: string) {
85
+ // Read file as base64
86
+ const base64 = await FileSystem.readAsStringAsync(fileUri, {
87
+ encoding: FileSystem.EncodingType.Base64,
88
+ });
89
+
90
+ // Decode GBK to UTF-8
91
+ const csvText = await decodeGBK(base64);
92
+
93
+ // Normalize line endings
94
+ const normalizedText = csvText.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
95
+
96
+ // Parse CSV
97
+ const result = Papa.parse(normalizedText, {
98
+ skipEmptyLines: true,
99
+ });
100
+
101
+ return result.data;
102
+ }
103
+ ```
104
+
105
+ ## License
106
+
107
+ MIT
108
+
109
+ ## Contributing
110
+
111
+ Contributions are welcome! Please feel free to submit a Pull Request.
112
+
113
+ ## Author
114
+
115
+ Evan Sun <zhidong.s@outlook.com>
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Automatically generated file. DO NOT MODIFY
3
+ */
4
+ package expo.modules.gbkconverter;
5
+
6
+ public final class BuildConfig {
7
+ public static final boolean DEBUG = Boolean.parseBoolean("true");
8
+ public static final String LIBRARY_PACKAGE_NAME = "expo.modules.gbkconverter";
9
+ public static final String BUILD_TYPE = "debug";
10
+ }
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ package="expo.modules.gbkconverter" >
4
+
5
+ <uses-sdk android:minSdkVersion="24" />
6
+
7
+ </manifest>
@@ -0,0 +1,18 @@
1
+ {
2
+ "version": 3,
3
+ "artifactType": {
4
+ "type": "AAPT_FRIENDLY_MERGED_MANIFESTS",
5
+ "kind": "Directory"
6
+ },
7
+ "applicationId": "expo.modules.gbkconverter",
8
+ "variantName": "debug",
9
+ "elements": [
10
+ {
11
+ "type": "SINGLE",
12
+ "filters": [],
13
+ "attributes": [],
14
+ "outputFile": "AndroidManifest.xml"
15
+ }
16
+ ],
17
+ "elementType": "File"
18
+ }
@@ -0,0 +1,6 @@
1
+ aarFormatVersion=1.0
2
+ aarMetadataVersion=1.0
3
+ minCompileSdk=1
4
+ minCompileSdkExtension=0
5
+ minAndroidGradlePluginVersion=1.0.0
6
+ coreLibraryDesugaringEnabled=false
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <merger version="3"><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\Personal\wallet-expo\modules\expo-gbk-converter\android\src\main\res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main" generated-set="main$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\Personal\wallet-expo\modules\expo-gbk-converter\android\src\main\res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\Personal\wallet-expo\modules\expo-gbk-converter\android\src\debug\res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug" generated-set="debug$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\Personal\wallet-expo\modules\expo-gbk-converter\android\src\debug\res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="generated$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\Personal\wallet-expo\modules\expo-gbk-converter\android\build\generated\res\resValues\debug"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="generated" generated-set="generated$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\Personal\wallet-expo\modules\expo-gbk-converter\android\build\generated\res\resValues\debug"/></dataSet><mergedItems/></merger>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\Personal\wallet-expo\modules\expo-gbk-converter\android\src\main\assets"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\Personal\wallet-expo\modules\expo-gbk-converter\android\src\debug\assets"/></dataSet><dataSet config="generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\Personal\wallet-expo\modules\expo-gbk-converter\android\build\intermediates\shader_assets\debug\compileDebugShaders\out"/></dataSet></merger>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\Personal\wallet-expo\modules\expo-gbk-converter\android\src\main\jniLibs"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\Personal\wallet-expo\modules\expo-gbk-converter\android\src\debug\jniLibs"/></dataSet></merger>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\Personal\wallet-expo\modules\expo-gbk-converter\android\src\main\shaders"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\Personal\wallet-expo\modules\expo-gbk-converter\android\src\debug\shaders"/></dataSet></merger>
@@ -0,0 +1,2 @@
1
+ R_DEF: Internal format may change without notice
2
+ local
@@ -0,0 +1,7 @@
1
+ 1<?xml version="1.0" encoding="utf-8"?>
2
+ 2<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ 3 package="expo.modules.gbkconverter" >
4
+ 4
5
+ 5 <uses-sdk android:minSdkVersion="24" />
6
+ 6
7
+ 7</manifest>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ package="expo.modules.gbkconverter" >
4
+
5
+ <uses-sdk android:minSdkVersion="24" />
6
+
7
+ </manifest>
@@ -0,0 +1,14 @@
1
+ -- Merging decision tree log ---
2
+ manifest
3
+ ADDED from D:\Personal\wallet-expo\modules\expo-gbk-converter\android\src\main\AndroidManifest.xml:1:1-2:12
4
+ INJECTED from D:\Personal\wallet-expo\modules\expo-gbk-converter\android\src\main\AndroidManifest.xml:1:1-2:12
5
+ package
6
+ INJECTED from D:\Personal\wallet-expo\modules\expo-gbk-converter\android\src\main\AndroidManifest.xml
7
+ uses-sdk
8
+ INJECTED from D:\Personal\wallet-expo\modules\expo-gbk-converter\android\src\main\AndroidManifest.xml reason: use-sdk injection requested
9
+ INJECTED from D:\Personal\wallet-expo\modules\expo-gbk-converter\android\src\main\AndroidManifest.xml
10
+ INJECTED from D:\Personal\wallet-expo\modules\expo-gbk-converter\android\src\main\AndroidManifest.xml
11
+ android:targetSdkVersion
12
+ INJECTED from D:\Personal\wallet-expo\modules\expo-gbk-converter\android\src\main\AndroidManifest.xml
13
+ android:minSdkVersion
14
+ INJECTED from D:\Personal\wallet-expo\modules\expo-gbk-converter\android\src\main\AndroidManifest.xml
@@ -0,0 +1,43 @@
1
+ apply plugin: 'com.android.library'
2
+
3
+ group = 'expo.modules.gbkconverter'
4
+ version = '1.0.0'
5
+
6
+ def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
7
+ apply from: expoModulesCorePlugin
8
+ applyKotlinExpoModulesCorePlugin()
9
+ useCoreDependencies()
10
+ useExpoPublishing()
11
+
12
+ // If you want to use the managed Android SDK versions from expo-modules-core, set this to true.
13
+ // The Android SDK versions will be bumped from time to time in SDK releases and may introduce breaking changes in your module code.
14
+ // Most of the time, you may like to manage the Android SDK versions yourself.
15
+ def useManagedAndroidSdkVersions = false
16
+ if (useManagedAndroidSdkVersions) {
17
+ useDefaultAndroidSdkVersions()
18
+ } else {
19
+ buildscript {
20
+ // Simple helper that allows the root project to override versions declared by this library.
21
+ ext.safeExtGet = { prop, fallback ->
22
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
23
+ }
24
+ }
25
+ project.android {
26
+ compileSdkVersion safeExtGet("compileSdkVersion", 36)
27
+ defaultConfig {
28
+ minSdkVersion safeExtGet("minSdkVersion", 24)
29
+ targetSdkVersion safeExtGet("targetSdkVersion", 36)
30
+ }
31
+ }
32
+ }
33
+
34
+ android {
35
+ namespace "expo.modules.gbkconverter"
36
+ defaultConfig {
37
+ versionCode 1
38
+ versionName "1.0.0"
39
+ }
40
+ lintOptions {
41
+ abortOnError false
42
+ }
43
+ }
@@ -0,0 +1,2 @@
1
+ <manifest>
2
+ </manifest>
@@ -0,0 +1,17 @@
1
+ package expo.modules.gbkconverter
2
+
3
+ import android.util.Base64
4
+ import expo.modules.kotlin.modules.Module
5
+ import expo.modules.kotlin.modules.ModuleDefinition
6
+ import java.nio.charset.Charset
7
+
8
+ class ExpoGbkConverterModule : Module() {
9
+ override fun definition() = ModuleDefinition {
10
+ Name("ExpoGbkConverter")
11
+
12
+ AsyncFunction("decode") { base64: String ->
13
+ val bytes = Base64.decode(base64, Base64.DEFAULT)
14
+ String(bytes, Charset.forName("GB18030"))
15
+ }
16
+ }
17
+ }
package/app.plugin.js ADDED
@@ -0,0 +1,3 @@
1
+ module.exports = function withExpoGbkConverter(config) {
2
+ return config;
3
+ };
@@ -0,0 +1,2 @@
1
+ export declare function decodeGBK(base64: string): Promise<string>;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEzD"}
package/build/index.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.decodeGBK = decodeGBK;
7
+ const ExpoGbkConverterModule_1 = __importDefault(require("./src/ExpoGbkConverterModule"));
8
+ function decodeGBK(base64) {
9
+ return ExpoGbkConverterModule_1.default.decode(base64);
10
+ }
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;AAEA,8BAEC;AAJD,0FAAwD;AAExD,SAAgB,SAAS,CAAC,MAAc;IACtC,OAAO,gCAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default: any;
2
+ export default _default;
3
+ //# sourceMappingURL=ExpoGbkConverterModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoGbkConverterModule.d.ts","sourceRoot":"","sources":["../../src/ExpoGbkConverterModule.ts"],"names":[],"mappings":";AAEA,wBAAuD"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const expo_modules_core_1 = require("expo-modules-core");
4
+ exports.default = (0, expo_modules_core_1.requireNativeModule)('ExpoGbkConverter');
5
+ //# sourceMappingURL=ExpoGbkConverterModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoGbkConverterModule.js","sourceRoot":"","sources":["../../src/ExpoGbkConverterModule.ts"],"names":[],"mappings":";;AAAA,yDAAwD;AAExD,kBAAe,IAAA,uCAAmB,EAAC,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ decode(): never;
3
+ };
4
+ export default _default;
5
+ //# sourceMappingURL=ExpoGbkConverterModule.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoGbkConverterModule.web.d.ts","sourceRoot":"","sources":["../../src/ExpoGbkConverterModule.web.ts"],"names":[],"mappings":";;;AAAA,wBAIE"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ decode() {
5
+ throw new Error('expo-gbk-converter is not supported on web');
6
+ },
7
+ };
8
+ //# sourceMappingURL=ExpoGbkConverterModule.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoGbkConverterModule.web.js","sourceRoot":"","sources":["../../src/ExpoGbkConverterModule.web.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,MAAM;QACJ,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;CACF,CAAC"}
@@ -0,0 +1,9 @@
1
+ {
2
+ "platforms": ["apple", "android", "web"],
3
+ "apple": {
4
+ "modules": ["ExpoGbkConverterModule"]
5
+ },
6
+ "android": {
7
+ "modules": ["expo.modules.gbkconverter.ExpoGbkConverterModule"]
8
+ }
9
+ }
@@ -0,0 +1,24 @@
1
+ Pod::Spec.new do |s|
2
+ s.name = 'ExpoGbkConverter'
3
+ s.version = '1.0.0'
4
+ s.summary = 'Expo module to decode GBK/GB18030 encoded text'
5
+ s.description = 'An Expo native module that decodes GBK/GB18030 encoded base64 strings to UTF-8 text, useful for parsing Chinese encoded files.'
6
+ s.author = 'Evan Sun'
7
+ s.homepage = 'https://github.com/evansuner/expo-gbk-converter'
8
+ s.license = 'MIT'
9
+ s.platforms = {
10
+ :ios => '15.1',
11
+ :tvos => '15.1'
12
+ }
13
+ s.source = { git: 'https://github.com/evansuner/expo-gbk-converter.git', tag: "v#{s.version}" }
14
+ s.static_framework = true
15
+
16
+ s.dependency 'ExpoModulesCore'
17
+
18
+ # Swift/Objective-C compatibility
19
+ s.pod_target_xcconfig = {
20
+ 'DEFINES_MODULE' => 'YES',
21
+ }
22
+
23
+ s.source_files = "**/*.{h,m,mm,swift,hpp,cpp}"
24
+ end
@@ -0,0 +1,26 @@
1
+ import ExpoModulesCore
2
+
3
+ public class ExpoGbkConverterModule: Module {
4
+ public func definition() -> ModuleDefinition {
5
+ Name("ExpoGbkConverter")
6
+
7
+ AsyncFunction("decode") { (base64: String) -> String in
8
+ guard let data = Data(base64Encoded: base64) else {
9
+ throw NSError(domain: "GBK", code: 1)
10
+ }
11
+
12
+ let cfEncoding = CFStringEncoding(
13
+ CFStringEncodings.GB_18030_2000.rawValue
14
+ )
15
+ let encoding = String.Encoding(
16
+ rawValue: CFStringConvertEncodingToNSStringEncoding(cfEncoding)
17
+ )
18
+
19
+ guard let text = String(data: data, encoding: encoding) else {
20
+ throw NSError(domain: "GBK", code: 2)
21
+ }
22
+
23
+ return text
24
+ }
25
+ }
26
+ }
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "expo-gbk-converter",
3
+ "version": "1.0.0",
4
+ "description": "An Expo module to decode GBK/GB18030 encoded text from base64 string",
5
+ "main": "build/index.js",
6
+ "types": "build/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "prepublishOnly": "npm run build",
10
+ "clean": "rm -rf build"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/evansuner/expo-gbk-converter.git"
15
+ },
16
+ "bugs": {
17
+ "url": "https://github.com/evansuner/expo-gbk-converter/issues"
18
+ },
19
+ "homepage": "https://github.com/evansuner/expo-gbk-converter#readme",
20
+ "keywords": [
21
+ "expo",
22
+ "expo-module",
23
+ "gbk",
24
+ "gb18030",
25
+ "encoding",
26
+ "decoder",
27
+ "chinese",
28
+ "react-native"
29
+ ],
30
+ "author": "Evan Sun <zhidong.s@outlook.com>",
31
+ "license": "MIT",
32
+ "peerDependencies": {
33
+ "expo": ">=51.0.0"
34
+ },
35
+ "devDependencies": {
36
+ "expo-modules-core": "^2.0.0",
37
+ "typescript": "^5.0.0"
38
+ },
39
+ "files": [
40
+ "build",
41
+ "src",
42
+ "android",
43
+ "ios",
44
+ "app.plugin.js",
45
+ "expo-module.config.json"
46
+ ]
47
+ }
@@ -0,0 +1,3 @@
1
+ import { requireNativeModule } from 'expo-modules-core';
2
+
3
+ export default requireNativeModule('ExpoGbkConverter');
@@ -0,0 +1,5 @@
1
+ export default {
2
+ decode() {
3
+ throw new Error('expo-gbk-converter is not supported on web');
4
+ },
5
+ };