I have a Galaxy S6 running Android 7.0:

zeroflte:/ $ getprop ro.build.version.release                                

There exists a file which uses the Unicode codepoint U+1F308 (RAINBOW) in its name:

zeroflte:/ $ ls -al /sdcard/tmp
total 1024
drwxrwx--x  5 root sdcard_rw 4096 2020-07-09 05:44 .
drwxrwx--x 49 root sdcard_rw 4096 2020-06-25 07:27 ..
-rw-rw----  1 root sdcard_rw   17 2018-04-25 20:47 123.org
drwxrwx--x  2 root sdcard_rw 4096 2020-07-09 05:54 crypt
-rw-rw----  1 root sdcard_rw    9 2020-07-08 13:26 🌈.gpx
zeroflte:/ $                                                                                                                                                                                                                                 

However, I have no idea how to use this file name in an adb shell command. I would like to apply ls -1 -d -l /sdcard/tmp/\🌈.gpx or similar, but I cannot enter the RAINBOW char. Any idea how to do this?

  • 2
    What about ls -1dl /sdcard/tmp/*.gpx? Or rename the file to remove special character. Commented Jul 9, 2020 at 11:07
  • Did you try Alt + or Ctrl + Shift + U or whatever key combination applicable to your OS for entering unicode characters? Commented Jul 9, 2020 at 11:16
  • I don't need it interactively. I'm the author of Emacs' Tramp package, which uses adb shell to access files on Android devices. So I need something which could be used in a script. Commented Jul 9, 2020 at 11:20
  • Unfortunately, not. zeroflte:/ $ ls -dl1 /sdcard/tmp/$(printf '\U0001f308').gpx ls: /sdcard/tmp/\U0001f308.gpx: No such file or directory Commented Jul 9, 2020 at 12:12
  • Don't know. How do I get this string? Commented Jul 9, 2020 at 12:18

1 Answer 1


mksh developer here.

mksh uses UTF-8 internally, but is currently limited to the BMP (basic multilingua plane), which means U+0000 to U+FFFD. If you want to use SMP codepoints (U-00010000 to U-0010FFFD) on the input line, you currently have to disable the UTF-8 mode (sorry):

$ set +U

That switches to a byte-wise mode which does not limit the input. (You can tab-complete files with SMP characters in them, but not directly input them, because input is validated.)

$ set -U   # switches back to UTF-8 mode

Switching mksh to full 21-bit Unicode is already on my TODO, and I’m currently hoping to be able to provide it for the next release.

  • 1
    Thanks, I've added your comment to Tramp. ATM I'm doing some workaround, executing the command in question via adb shell <command>. Commented Dec 28, 2020 at 17:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .