Skip to content

Commit

Permalink
Treat policy_templates.json as utf-8 encoded when translating
Browse files Browse the repository at this point in the history
Set the encoding of the policy_templates.json input file to utf-8.
Until now, its encoding was not specified in the translation definition
(grd file), which resulted in a default cp1252 encoding, leading to bad
characters in the output (and transitively in all generated artifacts,
including HTML policy docs, ADM/ADMX/ADML files, plist files, ..).
Note that we're not touching the encoding of grit's output files, so the
processing chain will now be:

policy_templates.json (utf-8)
  --(expect utf-8)--> grit --(write utf-16)-->
policy_templates_<lang>.json (utf-16)
  --(expect utf-16)--> template_formatter.py --(write encoding(X))-->
X=doc/admx/plist/..

The mismatch was that while policy_templates.json was encoded in utf-8,
grit expected utf-16 input encoding.

BUG=758836
TEST=Generated policy documentation (gn target policy_templates) and
     verified that special characters are treated properly.

Change-Id: I266a15b2ce78490ce9676905c105f20dfafbdfca
Reviewed-on: https://chromium-review.googlesource.com/707101
Commit-Queue: Pavol Marko <pmarko@chromium.org>
Reviewed-by: Maksim Ivanov <emaxx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#513512}
  • Loading branch information
Pavol Marko authored and Commit Bot committed Nov 2, 2017
1 parent e882ad9 commit 0c61a1e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components/policy/resources/policy_templates.grd
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ templates and will be translated for each locale. -->
<structures fallback_to_english="true">
<!-- List of policies and placeholder texts. This item should precede any
message definitions. -->
<structure name="IDD_POLICY_SOURCE_FILE" file="policy_templates.json" type="policy_template_metafile" />
<structure name="IDD_POLICY_SOURCE_FILE" file="policy_templates.json" type="policy_template_metafile" encoding="utf-8" />
</structures>
</release>
</grit>

0 comments on commit 0c61a1e

Please sign in to comment.