File 0505-Default-to-Unicode-for-filename-encoding-on-Android.patch of Package erlang
From 102577afa56b99483db2ed26cae8d0d9e0dafc3a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20de=20Bretagne?=
<jerome.debretagne@gmail.com>
Date: Mon, 31 Aug 2020 00:28:32 +0200
Subject: [PATCH] Default to Unicode for filename encoding on Android
---
erts/doc/src/erl_cmd.xml | 6 +++---
erts/emulator/sys/common/erl_sys_common_misc.c | 12 ++++++------
lib/kernel/doc/src/file.xml | 6 +++---
lib/stdlib/doc/src/unicode_usage.xml | 12 ++++++------
4 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/erts/emulator/sys/common/erl_sys_common_misc.c b/erts/emulator/sys/common/erl_sys_common_misc.c
index d34e1a9ec0..fd7c3b2cda 100644
--- a/erts/emulator/sys/common/erl_sys_common_misc.c
+++ b/erts/emulator/sys/common/erl_sys_common_misc.c
@@ -1,8 +1,8 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 2006-2018. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 2006-2020. All Rights Reserved.
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -49,9 +49,9 @@
static int filename_encoding = ERL_FILENAME_UNKNOWN;
static int filename_warning = ERL_FILENAME_WARNING_WARNING;
-#if defined(__WIN32__) || defined(__DARWIN__)
-/* Default unicode on windows and MacOS X */
-static int user_filename_encoding = ERL_FILENAME_UTF8;
+#if defined(__WIN32__) || defined(__DARWIN__) || defined(__ANDROID__)
+/* Default to Unicode on Windows, MacOS X and Android */
+static int user_filename_encoding = ERL_FILENAME_UTF8;
#else
static int user_filename_encoding = ERL_FILENAME_UNKNOWN;
#endif
diff --git a/lib/kernel/doc/src/file.xml b/lib/kernel/doc/src/file.xml
index 77d01925ec..86c4ee90e2 100644
--- a/lib/kernel/doc/src/file.xml
+++ b/lib/kernel/doc/src/file.xml
@@ -4,7 +4,7 @@
<erlref>
<header>
<copyright>
- <year>1996</year><year>2018</year>
+ <year>1996</year><year>2020</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -53,8 +53,8 @@
converts filenames back and forth to the native filename encoding
(usually UTF-8, but UTF-16 on Windows).</p>
- <p>The default mode depends on the operating system. Windows and
- MacOS X enforce consistent filename encoding and therefore the
+ <p>The default mode depends on the operating system. Windows, MacOS X
+ and Android enforce consistent filename encoding and therefore the
VM uses <c>utf8</c> mode.</p>
<p>On operating systems with transparent naming (for example, all Unix
diff --git a/lib/stdlib/doc/src/unicode_usage.xml b/lib/stdlib/doc/src/unicode_usage.xml
index 5f25e2c235..cc90f0dafb 100644
--- a/lib/stdlib/doc/src/unicode_usage.xml
+++ b/lib/stdlib/doc/src/unicode_usage.xml
@@ -5,7 +5,7 @@
<header>
<copyright>
<year>1999</year>
- <year>2017</year>
+ <year>2020</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -728,9 +728,9 @@ Eshell V5.10.1 (abort with ^G)
<taglist>
<tag>Mandatory Unicode file naming</tag>
<item>
- <p>Windows and, for most common uses, MacOS X enforce Unicode support
- for filenames. All files created in the file system have names that
- can consistently be interpreted. In MacOS X, all filenames are
+ <p>Windows, Android and, for most cases, MacOS X enforce Unicode support
+ for filenames. All files created in the file system have names that can
+ consistently be interpreted. In MacOS X and Android, all filenames are
retrieved in UTF-8 encoding. In Windows, each system call handling
filenames has a special Unicode-aware variant, giving much the same
effect. There are no filenames on these systems that are not Unicode
@@ -802,8 +802,8 @@ Eshell V5.10.1 (abort with ^G)
<p>Unicode filename translation is turned on with switch <c>+fnu</c>. On
Linux, a VM started without explicitly stating the filename translation
mode defaults to <c>latin1</c> as the native filename encoding. On
- Windows and MacOS X, the default behavior is that of Unicode filename
- translation. Therefore
+ Windows, MacOS X and Android, the default behavior is that of Unicode
+ filename translation. Therefore
<seealso marker="kernel:file#native_name_encoding/0"><c>file:native_name_encoding/0</c></seealso>
by default returns <c>utf8</c> on those systems (Windows does not use
UTF-8 on the file system level, but this can safely be ignored by the
--
2.26.2