Skip to content

Chinese language support! #294

Open
Open

Description

@sbraveyoung

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~

Activity

  1. pcottle commented on Nov 23, 2018

    @pcottle
    Contributor
  2. sbraveyoung commented on Nov 24, 2018

    @sbraveyoung
    Author

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

  3. muyinliu commented on Apr 30, 2021

    @muyinliu

    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.

  4. reopened this on Apr 30, 2021
  5. Hanaasagi commented on Jun 18, 2021

    @Hanaasagi

    @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.

    https://github.com/facebook/PathPicker/blob/e0d5cfc29ac67fcd1c0714275afdf0a80349d577/src/pathpicker/parse.py#L32

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions