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
F18819307: D17129.id.diff
Wed, Oct 22, 5:37 AM
F18769458: D17129.diff
Wed, Oct 8, 7:43 AM
F18631317: D17129.diff
Sep 16 2025, 3:00 PM
F18452079: D17129.diff
Sep 1 2025, 2:35 AM
F18394372: D17129.diff
Aug 29 2025, 9:55 AM
F18179959: D17129.id41193.diff
Aug 16 2025, 5:00 AM
F18156181: D17129.diff
Aug 14 2025, 9:40 PM
F18094276: D17129.id.diff
Aug 7 2025, 10:03 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.