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.
Tags
None
Referenced Files
F13046037: D17129.id41193.diff
Thu, Apr 18, 5:58 AM
F13046034: D17129.id.diff
Thu, Apr 18, 5:55 AM
F13046029: D17129.diff
Thu, Apr 18, 5:52 AM
Unknown Object (File)
Thu, Apr 11, 10:19 AM
Unknown Object (File)
Sat, Mar 30, 3:49 AM
Unknown Object (File)
Thu, Mar 28, 2:23 PM
Unknown Object (File)
Thu, Mar 28, 2:05 AM
Unknown Object (File)
Sat, Mar 23, 2:40 AM
Subscribers
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

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

Repository
rPHU libphutil
Lint
Lint Skipped
Unit
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.