0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-08-10 23:23:06 +00:00
Files
termux-packages/packages/openjdk-17/0012-Use-ASCII-codeset-on-android.patch
alexytomi 8d30dd9550 fix(openjdk-17): Readd deleted comments to commit message
Also regenerates for 17.0.16-ga
2025-07-23 00:33:24 -05:00

47 lines
1.9 KiB
Diff

From 84d2774fad890cd44834071605ee58d46052b68e Mon Sep 17 00:00:00 2001
From: Duy Tran Khanh <40482367+khanhduytran0@users.noreply.github.com>
Date: Thu, 10 Jun 2021 20:42:40 +0700
Subject: [PATCH 12/41] Use ASCII codeset on android
Since android's locale support is very rudimentary.
---
.../unix/native/libinstrument/EncodingSupport_md.c | 4 ++++
src/jdk.jdwp.agent/share/native/libjdwp/utf_util.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/src/java.instrument/unix/native/libinstrument/EncodingSupport_md.c b/src/java.instrument/unix/native/libinstrument/EncodingSupport_md.c
index 13cca6453fe..796666173d0 100644
--- a/src/java.instrument/unix/native/libinstrument/EncodingSupport_md.c
+++ b/src/java.instrument/unix/native/libinstrument/EncodingSupport_md.c
@@ -64,7 +64,11 @@ utfInitialize(void)
(void)setlocale(LC_ALL, "");
/* Get the codeset name */
+#ifndef __ANDROID__
codeset = (char*)nl_langinfo(CODESET);
+#else
+ codeset = "ASCII"; // (MB_CUR_MAX == 1) ? "ASCII" : "UTF-8";
+#endif
if ( codeset == NULL || codeset[0] == 0 ) {
UTF_DEBUG(("NO codeset returned by nl_langinfo(CODESET)\n"));
return;
diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/utf_util.c b/src/jdk.jdwp.agent/share/native/libjdwp/utf_util.c
index 3fb38893e7d..20ac7b27096 100644
--- a/src/jdk.jdwp.agent/share/native/libjdwp/utf_util.c
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/utf_util.c
@@ -483,7 +483,11 @@ static int iconvConvert(conv_direction drn, char *bytes, size_t len, char *outpu
// locale is not initialized, do it now
if (setlocale(LC_ALL, "") != NULL) {
// nl_langinfo returns ANSI_X3.4-1968 by default
+#ifndef __ANDROID__
codeset = (char*)nl_langinfo(CODESET);
+#else
+ codeset = "ASCII";
+#endif
}
if (codeset == NULL) {
--
2.50.1