Open sbraveyoung opened 5 years ago
Oh yeah there might not be utf8 support. Can you try using python3?
From: Younger notifications@github.com Reply-To: facebook/PathPicker reply@reply.github.com Date: Wednesday, November 21, 2018 at 7:31 PM To: facebook/PathPicker PathPicker@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [facebook/PathPicker] Chinese language support! (#294)
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~
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/facebook/PathPicker/issues/294, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABFRn_C2UD95O01qHrbF0sgOv0huQiSDks5uxgxhgaJpZM4Yuj42.
Oh, thanks a lot. I modify the fpp scripts that 'python' to 'python36', then this problem has disappeared.
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.
@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.
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 /([^\\\/]+)$/;
};
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~