thanhlong203 / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

Dealing white spaces is not enough in goog.string #249

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The regular expression /\s\xa0/ is used to recognize white spaces in 
goog.string#trim and other functions.
But this expression doesn't match to many white space defined in ECMAScript 5th 
in IE. For example, \u00A0, \u3000, \u2028, \u2029...

I want goog.string to match all white spaces defined in ECMAScript 5th. Because 
my language environment(Japanese) uses double-space(\u3000) so frequently.

> What steps will reproduce the problem?

 goog.string.trim('\u3000a b c');

> What is the expected output? What do you see instead?

Expected is 'a b c' but output ' a b c'.

> What version of the product are you using? On what operating system?

OS: Windows7 Enterprise 64bit
Browser: Internet Explorer 8

> Please provide any additional information below.

I wrote a patch to resolve this problem.
Defined some characters and regular expressions based on ECMAScript 5th. And 
replaced \s\xa0 to this regexp.

I referenced these data.
http://www.ecma-international.org/publications/standards/Ecma-262.htm (at 7.2 
and 7.3)
http://www.unicode.org/Public/6.0.0/ucd/PropList.txt

thank you.

Original issue reported on code.google.com by lv.wh...@gmail.com on 24 Dec 2010 at 11:16

Attachments:

GoogleCodeExporter commented 8 years ago
Issue 250 has been merged into this issue.

Original comment by Nicholas.J.Santos on 29 Dec 2010 at 4:59

GoogleCodeExporter commented 8 years ago

Original comment by nn...@google.com on 27 Apr 2012 at 10:20