commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dirk Henselin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-1282) StringUtils#normalizeSpace normalizeSpace should not replace non-breaking spaces with normal whitespace
Date Tue, 14 Nov 2017 17:42:00 GMT

    [ https://issues.apache.org/jira/browse/LANG-1282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16251808#comment-16251808
] 

Dirk Henselin commented on LANG-1282:
-------------------------------------

IMO StringUtils#normalizeSpace should be idempotent, i.e.
{code:java}
String s = "a\u00A0 b";
assertEquals(StringUtils.normalizeSpace(s), StringUtils.normalizeSpace(StringUtils.normalizeSpace(s)));
{code}
Hence non-breaking spaces should not be replaced by normal spaces. Simply remove the replacement
in the following line
{code:java}
newChars[count++] = (actualChar == 160 ? 32 : actualChar);
{code}



> StringUtils#normalizeSpace normalizeSpace should not replace non-breaking spaces with
normal whitespace
> -------------------------------------------------------------------------------------------------------
>
>                 Key: LANG-1282
>                 URL: https://issues.apache.org/jira/browse/LANG-1282
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 3.5
>            Reporter: Pascal Schumacher
>
> As of 3.4 StringUtils#normalizeSpace does not normalize non-breaking whitespace anymore.
Therefore it shouldn't replace a non-breaking whitespace white breaking whitespace, but both
assertions succeed:
> {code}
> assertEquals("a b", StringUtils.normalizeSpace("a\u00A0b"));
> assertEquals("a  b", StringUtils.normalizeSpace("a\u00A0 b"));
> {code}
> source: https://github.com/apache/commons-lang/pull/184



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message