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
F18179959: D17129.id41193.diff
Sat, Aug 16, 5:00 AM
F18156181: D17129.diff
Thu, Aug 14, 9:40 PM
F18094276: D17129.id.diff
Thu, Aug 7, 10:03 PM
F18086374: D17129.diff
Tue, Aug 5, 9:29 PM
Unknown Object (File)
May 31 2025, 9:05 PM
Unknown Object (File)
May 29 2025, 8:55 AM
Unknown Object (File)
May 26 2025, 6:17 AM
Unknown Object (File)
May 7 2025, 11:17 PM
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.