Commons Lang
  1. Commons Lang
  2. LANG-47

test.lang fails if compiled with non iso-8859-1 locales

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: None
    • Labels:
      None
    • Environment:

      Operating System: other
      Platform: Other

      Description

      Linux platform JDK 1.4.1_02

      $ export LANG=C ; ant clean && ant dist && ant test

      test.lang:
      [echo] Running lang package tests ...
      [java] .........................................
      [java] .........................................
      [java] .........................................
      [java] .........................................
      [java] ...........................F.F
      [java] Time: 0.402
      [java] There were 2 failures:
      [java] 1)
      testEscapeHtml(org.apache.commons.lang.StringEscapeUtilsTest)junit.framework.ComparisonFailure:
      languages expected:<...ccedil...> but was:<...#65533...>
      [java] at
      org.apache.commons.lang.StringEscapeUtilsTest.testEscapeHtml(StringEscapeUtilsTest.java:161)
      [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [java] at
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      [java] at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      [java] 2)
      testHtmlunescape(org.apache.commons.lang.StringEscapeUtilsTest)junit.framework.ComparisonFailure:
      languages expected:<...?...> but was:<...ç...>
      [java] at
      org.apache.commons.lang.StringEscapeUtilsTest.testHtmlunescape(StringEscapeUtilsTest.java:168)
      [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [java] at
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      [java] at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      [java] FAILURES!!!
      [java] Tests run: 192, Failures: 2, Errors: 0

      $ export LANG=en_US ; ant clean && ant dist && ant test

      [ this one works ]

      $ export LANG=en_US.utf-8 ; ant clean && ant dist && ant test

      [ fails, with a slightly different error #2: ]

      [java] 2)
      testHtmlunescape(org.apache.commons.lang.StringEscapeUtilsTest)junit.framework.ComparisonFailure:
      languages expected:<...�...> but was:<...ç...>

      LANG's setting for "ant test" does not appear to matter. If LANG=C for "ant
      dist", "ant test" will fail even if LANG=en_US.

        Activity

        Hide
        Sam Varshavchik added a comment -

        Works now in build 20030410

        Show
        Sam Varshavchik added a comment - Works now in build 20030410
        Hide
        Alex Chaffee added a comment -

        Fixed. Please confirm.

        In case you're interested, it was actually a problem in the test, not in the
        code. The test was passing in a string with non-ascii characters. When the
        test was compiled on a non-US/non-ASCII system, it encoded it as a different
        char, which naturally escaped/unescaped to a different entity. The fix was to
        escape the funky characters explicitly in the test.

        The line I changed had the following comment:
        // should we unicode-escape the cedilla here, for 7-bit cleanliness?

        Show
        Alex Chaffee added a comment - Fixed. Please confirm. In case you're interested, it was actually a problem in the test, not in the code. The test was passing in a string with non-ascii characters. When the test was compiled on a non-US/non-ASCII system, it encoded it as a different char, which naturally escaped/unescaped to a different entity. The fix was to escape the funky characters explicitly in the test. The line I changed had the following comment: // should we unicode-escape the cedilla here, for 7-bit cleanliness?
        Hide
        Henri Yandell added a comment -

        Alex?

        Show
        Henri Yandell added a comment - Alex?

          People

          • Assignee:
            Unassigned
            Reporter:
            Sam Varshavchik
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development