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

Chinese char in filename is ignored #845

Closed
baohengtao opened this issue May 25, 2024 · 6 comments
Closed

Chinese char in filename is ignored #845

baohengtao opened this issue May 25, 2024 · 6 comments
Labels

Comments

@baohengtao
Copy link

seems Chinese char is cleaned by this function.

  def clean_filename(filename: str) -> str:
      """Replaces invalid chars in filenames with '_'"""
      result = filename.encode(
          "utf-8").decode("ascii", "ignore")
      invalid = '<>:"/\\|?*\0'
  
      for char in invalid:
          result = result.replace(char, '_')
  
      return result

the output "假期_01.jpg" is "_01.jpg" without Chinese char

In [1]: clean_filename("假期_01.jpg")
Out[1]: _01.jpg  
@baohengtao baohengtao added the bug label May 25, 2024
@AndreyNikiforov
Copy link
Collaborator

Am I understanding the problem correctly that icloudpd saves file with Chinese chars replaced with '_'?

@baohengtao
Copy link
Author

Yea, suppose the actual filename is "假期_01.jpg", the filename downloaded by icloudpd will be "_01.jpg" and "假期“ is removed from the filename.

AndreyNikiforov added a commit to AndreyNikiforov/icloud_photos_downloader that referenced this issue May 25, 2024
@boredazfcuk
Copy link
Contributor

Is it possible that this is also the reason why quite a lot of Chinese users report "bad password" errors?

@AndreyNikiforov
Copy link
Collaborator

Is it possible that this is also the reason why quite a lot of Chinese users report "bad password" errors?

unlikely. the code for removing unicode chars from filenames seems to be there for ages

@boredazfcuk
Copy link
Contributor

Yeah, just wasn't sure if something similar was happening when processing passwords... or if Unicode character support was something that needed to be added when capturing text and possibly omitted by default.

@AndreyNikiforov
Copy link
Collaborator

added 1.18.0

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

No branches or pull requests

3 participants