Can't input text accents #58

Open
opened 2026-01-24 16:50:01 +01:00 by Benjamin_Loison · 5 comments
Owner
See [Benjamin_Loison/Backup_Android_apps/issues/81#issuecomment-10126176](https://codeberg.org/Benjamin_Loison/Backup_Android_apps/issues/81#issuecomment-10126176).
Author
Owner
Would help [Benjamin_Loison/Backup_Android_apps/issues/76](https://codeberg.org/Benjamin_Loison/Backup_Android_apps/issues/76).
Author
Owner
termux-accessibility type 'é'

works as wanted.

```bash termux-accessibility type 'é' ``` works as wanted.
Author
Owner
[Genymobile/scrcpy/pull/1426](https://github.com/Genymobile/scrcpy/pull/1426) may help.
Author
Owner
https://blog.rom1v.com/2018/03/introducing-scrcpy/#handle-accented-characters may help.
Author
Owner

DuckDuckGo and Google search scrcpy type command.

https://chat.mistral.ai/chat/ec79efb8-30c3-439b-9186-159b76877543

Is it possible to use scrcpy with a command line to type text?

Mistral:

Yes, scrcpy allows you to type text from the command line using the --clipboard or --shortcut options, but the most direct way is to use adb shell input text in combination with scrcpy.

How to Type Text via Command Line with scrcpy:

  1. Enable ADB:
    Ensure your Android device is connected via USB (or Wi-Fi) and adb is working:

    adb devices
    

    (You should see your device listed.)

  2. Type Text:
    Use adb shell input text to send text to your device:

    adb shell input text "Hello, this is typed from the command line!"
    
    • This will type the text as if you were using the on-screen keyboard.
    • Note: This method does not work in all apps (e.g., some secure fields like passwords may block it).
  3. Alternative: scrcpy + Clipboard:
    If you want to paste text from your computer's clipboard:

    scrcpy --clipboard
    
    • Copy text on your computer, then press Ctrl+V in scrcpy to paste it.
  4. Shortcut for Special Keys:
    Use scrcpy --shortcut to map keyboard shortcuts (e.g., Ctrl+C to copy, Ctrl+V to paste).


Example Workflow:

  1. Open a text field on your Android device (e.g., in a notes app).
  2. Run:
    adb shell input text "This is a test."
    
    The text will appear in the active field.

Limitations:

  • Some apps (e.g., banking apps) may block adb input for security.
  • Special characters or Unicode may require additional escaping.

https://chatgpt.com/share/69f94812-7408-83eb-b99f-27771cd9f54cc

Error:
Traceback (most recent call last):
  File "/home/CENSORED/Desktop/Benjamin/Backup_Android_apps/./main.py", line 1205, in <module>
    backupOrRestoreApp(PACKAGE_NAME)
  File "/home/CENSORED/Desktop/Benjamin/Backup_Android_apps/./main.py", line 569, in backupOrRestoreApp
    exec(getAppScript(PACKAGE_NAME))
  File "<string>", line 140, in <module>
  File "/home/CENSORED/Desktop/Benjamin/Backup_Android_apps/./main.py", line 361, in writeText
    text = unidecode(text)
           ^^^^^^^^^^^^^^^
  File "/home/CENSORED/venv/lib/python3.12/site-packages/unidecode/__init__.py", line 60, in unidecode_expect_ascii
    bytestring = string.encode('ASCII')
                 ^^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'encode'
DuckDuckGo and Google search *scrcpy type command*. https://chat.mistral.ai/chat/ec79efb8-30c3-439b-9186-159b76877543 > Is it possible to use `scrcpy` with a command line to type text? <details> <summary>Mistral:</summary> Yes, **`scrcpy`** allows you to type text from the command line using the `--clipboard` or `--shortcut` options, but the most direct way is to use **`adb shell input text`** in combination with `scrcpy`. ### How to Type Text via Command Line with `scrcpy`: 1. **Enable ADB**: Ensure your Android device is connected via USB (or Wi-Fi) and `adb` is working: ```bash adb devices ``` (You should see your device listed.) 2. **Type Text**: Use `adb shell input text` to send text to your device: ```bash adb shell input text "Hello, this is typed from the command line!" ``` - This will type the text as if you were using the on-screen keyboard. - **Note**: This method does not work in all apps (e.g., some secure fields like passwords may block it). 3. **Alternative: `scrcpy` + Clipboard**: If you want to paste text from your computer's clipboard: ```bash scrcpy --clipboard ``` - Copy text on your computer, then press **Ctrl+V** in `scrcpy` to paste it. 4. **Shortcut for Special Keys**: Use `scrcpy --shortcut` to map keyboard shortcuts (e.g., `Ctrl+C` to copy, `Ctrl+V` to paste). --- ### Example Workflow: 1. Open a text field on your Android device (e.g., in a notes app). 2. Run: ```bash adb shell input text "This is a test." ``` The text will appear in the active field. --- ### Limitations: - Some apps (e.g., banking apps) may block `adb input` for security. - Special characters or Unicode may require additional escaping. </details> https://chatgpt.com/share/69f94812-7408-83eb-b99f-27771cd9f54cc <details> <summary>Error:</summary> ``` Traceback (most recent call last): File "/home/CENSORED/Desktop/Benjamin/Backup_Android_apps/./main.py", line 1205, in <module> backupOrRestoreApp(PACKAGE_NAME) File "/home/CENSORED/Desktop/Benjamin/Backup_Android_apps/./main.py", line 569, in backupOrRestoreApp exec(getAppScript(PACKAGE_NAME)) File "<string>", line 140, in <module> File "/home/CENSORED/Desktop/Benjamin/Backup_Android_apps/./main.py", line 361, in writeText text = unidecode(text) ^^^^^^^^^^^^^^^ File "/home/CENSORED/venv/lib/python3.12/site-packages/unidecode/__init__.py", line 60, in unidecode_expect_ascii bytestring = string.encode('ASCII') ^^^^^^^^^^^^^ AttributeError: 'int' object has no attribute 'encode' ``` </details>
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Benjamin_Loison/adb#58