You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by phoenix384 <gi...@git.apache.org> on 2016/08/25 10:22:39 UTC

[GitHub] commons-lang pull request #184: Correct replacing 160 in normalizeSpace

GitHub user phoenix384 opened a pull request:

    https://github.com/apache/commons-lang/pull/184

    Correct replacing 160 in normalizeSpace

    Normalizing spaces of a string containing a nbsp (160) followed by a regular whitespace results in a string containing a double space character instead. You have to execute normalize-space() twice to get a string with only single spaces.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/phoenix384/commons-lang patch-1

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/commons-lang/pull/184.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #184
    
----
commit 09fd988b7f94a51c4bc73edf36bf809ac493c5bf
Author: phoenix384 <ph...@gmx.de>
Date:   2016-08-25T10:22:27Z

    Correct replacing 160 in normalizeSpace
    
    Normalizing spaces of a string containing a nbsp (160) followed by a regular whitespace results in a string containing a double space character instead. You have to execute normalize-space() twice to get a string with only single spaces.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] commons-lang issue #184: Correct replacing 160 in normalizeSpace

Posted by PascalSchumacher <gi...@git.apache.org>.
Github user PascalSchumacher commented on the issue:

    https://github.com/apache/commons-lang/pull/184
  
    the non-breaking space replacement was added with https://issues.apache.org/jira/browse/LANG-910


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] commons-lang issue #184: Correct replacing 160 in normalizeSpace

Posted by PascalSchumacher <gi...@git.apache.org>.
Github user PascalSchumacher commented on the issue:

    https://github.com/apache/commons-lang/pull/184
  
    Thanks for the information. I did not know that `normalizeSpace` replaces non-breaking spaces with normal whitespace.
    
    Both these test succeed:
    
    ```java
    assertEquals("a b", StringUtils.normalizeSpace("a\u00A0b"));
    assertEquals("a  b", StringUtils.normalizeSpace("a\u00A0 b"));
    ```
    
    The argument brought forward as to why `normalizeSpace` does not normalize non-breaking space anymore was that `Character#isWhitespace` returns `false`. Like I said I do not agree with this argument.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] commons-lang issue #184: Correct replacing 160 in normalizeSpace

Posted by PascalSchumacher <gi...@git.apache.org>.
Github user PascalSchumacher commented on the issue:

    https://github.com/apache/commons-lang/pull/184
  
    @phoenix384 The problem is that starting with 3.4 StringUtils#normalizeSpace no longer normalizes unicode non-breaking spaces. I reported this as a bug and argued for reverting this behavior, but other people disagreed. :( 
    
    For details see:
    https://github.com/apache/commons-lang/pull/113
    https://issues.apache.org/jira/browse/LANG-1184 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] commons-lang issue #184: Correct replacing 160 in normalizeSpace

Posted by phoenix384 <gi...@git.apache.org>.
Github user phoenix384 commented on the issue:

    https://github.com/apache/commons-lang/pull/184
  
    But it can't be the desired behaviour, that executing normalize-space twice normalizes non-breaking spaces while executing it once replaces them with a normal whitespace.
    Either don't touch them or normalize them immediately.
    I would prefer to normalize them, since they simply are white spaces.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] commons-lang pull request #184: Correct replacing 160 in normalizeSpace

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/commons-lang/pull/184


---