Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to push file with Chinese character to my device (adb bug) #2184

Open
migschen opened this issue Mar 9, 2021 · 9 comments
Open

failed to push file with Chinese character to my device (adb bug) #2184

migschen opened this issue Mar 9, 2021 · 9 comments

Comments

@migschen
Copy link

migschen commented Mar 9, 2021

  • [OK ] I have read the FAQ.
  • [OK] I have searched in existing issues.

Environment

  • OS: Win10
  • scrcpy version: 1.17
  • installation method: Windows release
  • device model:
  • Android version: 8
  • adb version: 1.0.41

When i drag a file with Chinese character to the device,it response like this:
adb: error: failed to copy 'D:\TRANS\中文名.jpg' to '/sdcard/.': remote couldn't create file: Is a directory

I know it's a bug in adb,but there is a solution to fix the problem.
When u execute the command like this
adb push D:\TRANS\中文名.jpg /sdcard/
it will fail 100%.
but if u execute with this way :
adb push D:\TRANS\中文名.jpg /sdcard/中文名.jpg
it will be success and with a correct filename;

It looks like scrcpy excute the command like the first way?(not sure)
So,is it OK to change the command the scrcpy excutes?
Hope it can be fixed.
Thank u so much!

@migschen migschen changed the title failed to push file with Chinese character to my device ( failed to push file with Chinese character to my device (adb bug) Mar 9, 2021
@Biswa96
Copy link
Contributor

Biswa96 commented Mar 9, 2021

Recently I fixed this same type of issue in a cygwin program by adding setlocale(LC_ALL, "");. I am not sure if this trick works here but here my 2¢

@rom1v
Copy link
Collaborator

rom1v commented Mar 9, 2021

adb push D:\TRANS\中文名.jpg /sdcard/
it will fail 100%.

I just tested (with adb push C:\Users\..\中文名.txt) on Windows (using adb 1.0.41 included in the Windows release), it works correctly for me.

@migschen
Copy link
Author

migschen commented Mar 9, 2021

adb push D:\TRANS\中文名.jpg /sdcard/
it will fail 100%.

I just tested (with adb push C:\Users\..\中文名.txt) on Windows (using adb 1.0.41 included in the Windows release), it works correctly for me.

It doesn't work for me :(, I think it's because Chinese-Simplified Windows ecoded the filename by GB2312/GBK ,so it failed.
But add the original filename to the target argument will work.
here is the test result I did:

Android Debug Bridge version 1.0.41
Version 30.0.5-6877874

C:\WINDOWS\system32>adb push D:\TRANS\test.txt /sdcard/
D:\TRANS\test.txt: 1 file pushed, 0 skipped.

C:\WINDOWS\system32>adb push D:\TRANS\中文名.txt /sdcard/
D:\TRANS\中文名.txt: 1 file pushed, 0 skipped.
adb: error: failed to copy 'D:\TRANS\中文名.txt' to '/sdcard/.': remote couldn't create file: Is a directory

C:\WINDOWS\system32>adb push D:\TRANS\中文名.txt /sdcard/中文名.txt
D:\TRANS\中文名.txt: 1 file pushed, 0 skipped.

have no idea...

@migschen
Copy link
Author

migschen commented Mar 9, 2021

Recently I fixed this same type of issue in a cygwin program by adding setlocale(LC_ALL, "");. I am not sure if this trick works here but here my 2¢

I know little about Linux & C ...

@rom1v
Copy link
Collaborator

rom1v commented Mar 9, 2021

remote couldn't create file: Is a directory

It's probably an error on the device, so it depends on the adb server version on your device.

@migschen
Copy link
Author

migschen commented Mar 9, 2021

It's probably an error on the device, so it depends on the adb server version on your device.

I test it on Android 5.0.1 and Android 8.0 even on an andorid emulator(7.0),it all failed...
Wheher u will change the function adb_push(const char *serial, const char *local, const char *remote) / adb_execute(const char *serial, const char *const adb_cmd[], size_t len) or so to make it work in the next release?
If so ,I'm looking forward to it :) .
Thanks u so much!

@migschen
Copy link
Author

adb push D:\TRANS\中文名.jpg /sdcard/
it will fail 100%.

I just tested (with adb push C:\Users\..\中文名.txt) on Windows (using adb 1.0.41 included in the Windows release), it works correctly for me.

Sorry ,that's not 100% ...to some extent...
I tested more, but found a very very weird phenomenon after I dragged them all to the device.
as the picture shows, only the file with even number of Chinese characters was pushed to device...
However, the files pushed successfully lost some characters or is just 0B size, and the file with 0B even can't be deleted on the device...(only adb shell rm works)
oh my god...I'm confused...so werid!
tests

@BabyCY
Copy link

BabyCY commented Jan 10, 2022

I ran into the same problem.

@BabyCY
Copy link

BabyCY commented Jan 20, 2022

@rom1v Maybe it's the same question as this one? openstf/adbkit#127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants