Browse Source

Ensure the test runner decodes files as UTF-8 (#2246)

* Ensure the test runner decodes files as UTF-8

Before this change, the `document.charset` of the HTML test files would be 'windows-1252' when accessed through the `file://` protocol, resulting in issues with library or test files containing non-ASCII symbols.

This patch ensures tests still run correctly when files contain non-ASCII symbols.

* Ensure ASCII-safety of source code
pull/2249/head
Mathias Bynens 7 years ago
committed by penmetsaa
parent
commit
b32a9df729
6 changed files with 8 additions and 3 deletions
  1. +1
    -0
      javascript/i18n/phonenumbers/asyoutypeformatter_test.html
  2. +1
    -0
      javascript/i18n/phonenumbers/demo-compiled.html
  3. +1
    -0
      javascript/i18n/phonenumbers/demo.html
  4. +3
    -3
      javascript/i18n/phonenumbers/phonenumberutil.js
  5. +1
    -0
      javascript/i18n/phonenumbers/phonenumberutil_test.html
  6. +1
    -0
      javascript/i18n/phonenumbers/shortnumberinfo_test.html

+ 1
- 0
javascript/i18n/phonenumbers/asyoutypeformatter_test.html View File

@ -20,6 +20,7 @@ limitations under the License.
Author: Nikolaos Trogkanis
-->
<head>
<meta charset="utf-8">
<title>libphonenumber Unit Tests - i18n.phonenumbers - asyoutypeformatter.js</title>
<script src="../../../../closure-library/closure/goog/base.js"></script>
<script>


+ 1
- 0
javascript/i18n/phonenumbers/demo-compiled.html View File

@ -20,6 +20,7 @@ limitations under the License.
Author: Nikolaos Trogkanis
-->
<head>
<meta charset="utf-8">
<title>Phone Number Parser Demo</title>
<script src="demo-compiled.js"></script>
</head>


+ 1
- 0
javascript/i18n/phonenumbers/demo.html View File

@ -20,6 +20,7 @@ limitations under the License.
Author: Nikolaos Trogkanis
-->
<head>
<meta charset="utf-8">
<title>Phone Number Parser Demo</title>
<script src="../../../../closure-library/closure/goog/base.js"></script>
<script>


+ 3
- 3
javascript/i18n/phonenumbers/phonenumberutil.js View File

@ -778,11 +778,11 @@ i18n.phonenumbers.PhoneNumberUtil.CAPTURING_EXTN_DIGITS_ =
i18n.phonenumbers.PhoneNumberUtil.EXTN_PATTERNS_FOR_PARSING_ =
i18n.phonenumbers.PhoneNumberUtil.RFC3966_EXTN_PREFIX_ +
i18n.phonenumbers.PhoneNumberUtil.CAPTURING_EXTN_DIGITS_ + '|' +
'[ \u00A0\\t,]*' +
'[ \xA0\\t,]*' +
'(?:e?xt(?:ensi(?:o\u0301?|\u00F3))?n?|\uFF45?\uFF58\uFF54\uFF4E?|' +
'доб|\u0434\u043E\u0431|ДОБ|' +
'\u0434\u043E\u0431|\u0414\u041E\u0411|' +
'[;,x\uFF58#\uFF03~\uFF5E]|int|anexo|\uFF49\uFF4E\uFF54)' +
'[:\\.\uFF0E]?[ \u00A0\\t,-]*' +
'[:\\.\uFF0E]?[ \xA0\\t,-]*' +
i18n.phonenumbers.PhoneNumberUtil.CAPTURING_EXTN_DIGITS_ + '#?|' +
'[- ]+([' + i18n.phonenumbers.PhoneNumberUtil.VALID_DIGITS_ + ']{1,5})#';


+ 1
- 0
javascript/i18n/phonenumbers/phonenumberutil_test.html View File

@ -20,6 +20,7 @@ limitations under the License.
Author: Nikolaos Trogkanis
-->
<head>
<meta charset="utf-8">
<title>libphonenumber Unit Tests - i18n.phonenumbers - phonenumberutil.js</title>
<script src="../../../../closure-library/closure/goog/base.js"></script>
<script>


+ 1
- 0
javascript/i18n/phonenumbers/shortnumberinfo_test.html View File

@ -20,6 +20,7 @@ limitations under the License.
Author: Nikolaos Trogkanis
-->
<head>
<meta charset="utf-8">
<title>libphonenumber Unit Tests - i18n.phonenumbers - shortnumberinfo.js</title>
<script src="../../../../closure-library/closure/goog/base.js"></script>
<script>


Loading…
Cancel
Save