From 898a9fd06e96110944c5e15f9536eae8ccbe31da Mon Sep 17 00:00:00 2001 From: Igor Klimer Date: Mon, 3 Apr 2017 20:25:56 +0200 Subject: [PATCH] Domains: Convert characters to basic Latin, when possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The WHOIS specification does not define the required character set to be used, but most WHOIS servers use just the basic Latin character set, so that's what we enforce too. This change automagically converts other characters to their basic Latin versions using the `deburr` method from Lodash. So `ś` becomes `s`, `ą` -> `a`, etc. Fixes #12559 --- .../upgrades/checkout/domain-details-form.jsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/client/my-sites/upgrades/checkout/domain-details-form.jsx b/client/my-sites/upgrades/checkout/domain-details-form.jsx index 19d1ffa637c45..ea0eaf0b79195 100644 --- a/client/my-sites/upgrades/checkout/domain-details-form.jsx +++ b/client/my-sites/upgrades/checkout/domain-details-form.jsx @@ -3,7 +3,15 @@ */ import React from 'react'; import classNames from 'classnames'; -import { camelCase, head, kebabCase, map, omit, reduce } from 'lodash'; +import { + camelCase, + deburr, + head, + kebabCase, + map, + omit, + reduce, +} from 'lodash'; /** * Internal dependencies @@ -73,7 +81,7 @@ export default React.createClass( { const sanitizedFieldValues = Object.assign( {}, fieldValues ); this.fieldNames.forEach( ( fieldName ) => { if ( typeof fieldValues[ fieldName ] === 'string' ) { - sanitizedFieldValues[ fieldName ] = fieldValues[ fieldName ].trim(); + sanitizedFieldValues[ fieldName ] = deburr( fieldValues[ fieldName ].trim() ); if ( fieldName === 'postalCode' ) { sanitizedFieldValues[ fieldName ] = sanitizedFieldValues[ fieldName ].toUpperCase(); }