Page MenuHomePhabricator

File xsprintf.php should set locale explicitly to support non-latin filenames in repository
Needs ReviewPublic

Authored by huangsj on Jan 2 2017, 1:55 AM.
Referenced Files
F10881979: D17129.diff
Thu, Jun 30, 9:30 PM
Unknown Object (File)
Sun, Jun 26, 5:22 PM
Unknown Object (File)
Sun, Jun 26, 5:21 PM
Unknown Object (File)
Wed, Jun 15, 9:09 PM
Unknown Object (File)
Sat, Jun 4, 7:34 AM
Unknown Object (File)
Fri, Jun 3, 11:45 AM
Unknown Object (File)
Wed, Jun 1, 12:40 PM
Unknown Object (File)
May 31 2022, 2:49 AM
This revision needs review, but there are no reviewers specified.



When I fixed T11626: Phabricator should properly display non-English characters such as Chinese in diffusion commit page, I discovered that although filenames are displayed correctly as described in T11626, I still could not view its content.

I created a file "读我文件.md" with its content "读我的内容" in repository "R1:测试代码库1".
when I browsed a specific commit, say "b863740eab66", I could not view file content, Phabricator kept saying "Loading".

pasted_file (1×2 px, 313 KB)

pasted_file (696×1 px, 52 KB)

If I apply this patch, the file content will display.

pasted_file (714×1 px, 61 KB)

Test Plan

1 Create a repository 测试代码库1 and add 1 file "读我文件.md" with its content "读我的内容" to this repository.
2 Browse this repository and navigate to a specific commit when "读我文件.md" is added.

pasted_file (1×2 px, 313 KB)

3 Click "读我文件.md" and the following should display.

pasted_file (714×1 px, 61 KB)

Diff Detail

rPHU libphutil
Lint Skipped
Tests Skipped

Event Timeline

huangsj edited the test plan for this revision. (Show Details)

Please file a task describing exactly what the issue is. Executing a global setlocale() as a side effect is certainly not the best solution.

You're right.
Explicitly setlocale globally is not the best.

I think what I should do is to set environment variable LANG to something like zh-CN.UTF-8 in my Linux machine to support Chinese filenames.