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 language support! #294

Open
sbraveyoung opened this issue Nov 22, 2018 · 4 comments
Open

Chinese language support! #294

sbraveyoung opened this issue Nov 22, 2018 · 4 comments
Labels

Comments

@sbraveyoung
Copy link

Hey,
I'm Chinese, and my system language of CentOS is Chinese yet. I use fpp with git status, but all of Chinese character are become messy code, it's very unfriendly. Is there has any solution to solve it? THX very much~

@pcottle
Copy link
Contributor

pcottle commented Nov 23, 2018 via email

@sbraveyoung
Copy link
Author

Oh, thanks a lot. I modify the fpp scripts that 'python' to 'python36', then this problem has disappeared.

@muyinliu
Copy link

muyinliu commented Apr 30, 2021

Still NOT work with git status with path contains Chinese characters. Reproduce with commands:

mkdir fpp-chinese-test
cd fpp-chinese-test
echo "test" > 测试.txt
git init
git status | fpp

=>

No lines matched!!

Note: fpp v0.9.2

Please reopen this issue.

@KapJI KapJI reopened this Apr 30, 2021
@KapJI KapJI added the bug label Apr 30, 2021
@Hanaasagi
Copy link

@muyinliu @KapJI

It's actually a problem of using regex to match a filename that includes unicode. I see most regex are
a-z.A-Z0-9. It will not match the unicode, only work with ASCII.

JUST_FILE = re.compile(r"([@%+a-z.A-Z0-9\-_]+\.[a-zA-Z]{1,10})(\s|$|:)+")

In Python3 \w can do this, but not all unicode.

\w

For Unicode (str) patterns:

    Matches Unicode word characters; this includes most characters that can be part of a word in any language, as well as numbers and the underscore. If the ASCII flag is used, only [a-zA-Z0-9_] is matched.

if change the regex to JUST_FILE = re.compile(r"([@%+\w\-_]+\.[a-zA-Z]{1,10})(\s|$|:)+"), it can match the file named 测试.txt.

Additionally, there is a filename-regex package in javascript. It uses more looser regex.

module.exports = function filenameRegex() {
  return /([^\\\/]+)$/;
};

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

5 participants