Page MenuHomePhabricator

arc set-config encoding XXX not work
Closed, ResolvedPublic


I build env from $ git clone && $ git clone

I’m setting a new project encoding with GBK, and call arc set-config encoding GBK affect to ~/.arcrc

when i exec arc diff, it didn't load encoding from ~/.arcrc, just use UTF-8 as default, when use --encoding GBK , it works fine.

so i trace source of arcanist, modify it , then encoding conf works!

the diff is below: will you patch to source ? ( so i can get a raw git clone to work, thanks a lot!)

diff --git a/src/workflow/ArcanistWorkflow.php b/src/workflow/ArcanistWorkflow.php
index 2365083..c26a5aa 100644
--- a/src/workflow/ArcanistWorkflow.php
+++ b/src/workflow/ArcanistWorkflow.php
@@ -1592,7 +1592,7 @@ abstract class ArcanistWorkflow extends Phobject {
   final protected function getRepositoryEncoding() {
     return nonempty(
       idx($this->loadProjectRepository(), 'encoding'),
-      'UTF-8');
+        $this->getConfigFromAnySource('encoding','UTF-8'));
   final protected function loadProjectRepository() {

Event Timeline

Well, it looks like we didn't expect users to set encoding from arc:

$ arc get-config --verbose  encoding

    (This configuration value is not recognized by arc. It may be misspelled
    or out of date.)

The way the existing code works, is it loads the repository information from Phabricator, and uses the encoding information from there (There's a fair amount of magic in how the Phabricator repository is identified - you can use arc which to figure out most of it).
So the expected workflow is to edit the repository in the server: RepositoryManage RepositoryEdit Text Encoding.

Will that workflow work for you?

Also note that all non-UTF-8 encoding support in the server is a little experimental, and many things might not work properly.

The docs do say you can set encoding in .arcconfig, but I suspect that this might be out-dated, as the code appears not to use that value.

We should maybe provide a warning when using set-config to an unknown setting, to expose that better?

I think it was historically possible for third-party code to read custom config, but not possible for them to add new settings until D16928 (Nov 2016), which might be why we don't warn about bad values. Should be fine to do so now, though.

We should also either fix the documentation or make it accurate, although if we respect encoding in .arcconfig from arc we should warn about conflicts between arc and Diffusion config, and ideally respect the arc value in Diffusion, which I believe is difficult (but perhaps worth building, as it would apply to some other problems as well).

This comment was removed by xian0617.

thanks all your answers

I‘m not a admin of Phabricator, and as i know, our Phabricator is older version, haha...

the older project is configure as ... i make a big mistake of versions ...

    "project_id" : "jsoncpp",
    "conduit_uri" : ""

This setting (In the Phabricator web interface) is very old, and should exist in all versions. Ask your admin to configure it (Assuming your admin created the repository).

avivey claimed this task.

Presumably resolved.