Commit 8d3ba5c3 authored by Mike Frysinger's avatar Mike Frysinger Committed by Commit Bot

grit: drop Unicode BOM from Chrome messages.json

The BOM was added back in Dec 2012 [1] because it said the CWS wanted
it in its files.  However, I haven't seen this requirement in the last
few years with my own extensions (uploaded plenty w/out BOMs and the
localization still works), and our public docs [2] don't mention it.
Drop the BOM to shrink (slightly) the files and to make it easier
for other JSON parsers to handle this (as not all skip the BOM).

Further, reading the CWS source directly indicates it is not required
and is silently ignored.  See CrxMessagesParserImpl.java:parse() which
loads the JSON data through ManifestSanitizerUtil.sanitize(), and that
ManifestSanitizerUtil.java:sanitize function simply does:
  // The incoming manifest may have a byte-order marker (0xFEFF) to denote
  // Unicode as its first character.  Although it's not allowed in pure JSON,
  // we remove it here so parse just works
  if (content.charAt(0) == Constants.UNICODE_BYTE_ORDER_MARK) {
    content = content.substring(1);
  }
  return content;

Url-1: https://codereview.chromium.org/11557029
Url-2: https://developer.chrome.com/extensions/i18n-messages
Bug: 852585
Change-Id: I65f61eecb1147cd4c05f3a7a2295bef85023cb65
Reviewed-on: https://chromium-review.googlesource.com/1101239Reviewed-by: default avataragrieve <agrieve@chromium.org>
Reviewed-by: default avatarRobert Flack <flackr@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567387}
parent fa348e7a
...@@ -339,11 +339,9 @@ are exported to translation interchange files (e.g. XMB files), etc. ...@@ -339,11 +339,9 @@ are exported to translation interchange files (e.g. XMB files), etc.
'gzipped_resource_file_map_source'): 'gzipped_resource_file_map_source'):
return 'cp1252' return 'cp1252'
if output_type in ('android', 'c_format', 'js_map_format', 'plist', if output_type in ('android', 'c_format', 'js_map_format', 'plist',
'plist_strings', 'doc', 'json', 'android_policy'): 'plist_strings', 'doc', 'json', 'android_policy',
'chrome_messages_json'):
return 'utf_8' return 'utf_8'
if output_type in ('chrome_messages_json'):
# Chrome Web Store currently expects BOM for UTF-8 files :-(
return 'utf-8-sig'
# TODO(gfeher) modify here to set utf-8 encoding for admx/adml # TODO(gfeher) modify here to set utf-8 encoding for admx/adml
return 'utf_16' return 'utf_16'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment