Skip to main content

Bug Tracker

Side navigation

#4980 closed bug (fixed)

Opened July 27, 2009 09:11PM UTC

Closed November 30, 2009 06:22PM UTC

Character 160 ("Non-breaking space") not removed using trim() in Internet Explorer

Reported by: aakoch Owned by:
Priority: minor Milestone: 1.4
Component: core Version: 1.3.2
Keywords: trim Cc:
Blocked by: Blocking:
Description

If a string contains the "Non-breaking space" character (char code 160), Internet Explorer and Safari won't see that as a white-space character and the trim() method won't strip the character from the string.

Here's a small write-up about it: http://www.adamkoch.com/2009/07/25/white-space-and-character-160/

Here's a test page: http://www.adamkoch.com/char160test.html

Both trim methods should return an empty string.

A fix could be to add the character to the trim method's regular expression:

/^(\\s|\\u00A0)+|(\\s|\\u00A0)+$/g

Attachments (0)
Change History (3)

Changed August 08, 2009 03:50PM UTC by jerone comment:1

I confirm this in all IE (6-8) and seems like a valid solution.

Changed November 11, 2009 08:17PM UTC by john comment:2

component: unfilledcore

Changed November 30, 2009 06:22PM UTC by yehuda comment:3

resolution: → fixed
status: newclosed

Closed in 17955cacf4e8c618ca5c2b09b0d2f43df353f683