JBehave
  1. JBehave
  2. JBEHAVE-421

Use of String.toUpper/LowerCase() should be locale-aware

    Details

    • Type: Improvement Improvement
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.2
    • Fix Version/s: 3.2, web-3.2
    • Component/s: Core, Web Selenium
    • Labels:
      None
    • Environment:
      Windows with Turkish locale, jbehave-3.1.2
    • Number of attachments :
      1

      Description

      In Turkish, there are two letters in order to symbolize English's I. They are I and İ (I with dot). Lower case of "I" is "ı" (i without dot) and lower case of "İ" (I with dot) is "i". Users from different nations may encounter with this kind of problems, which come to surface when using String.toUpper/LowerCase(). The solution is to use String.toUpper/LowerCase(Locale), while defaulting to Locale.getDefault() if none specified.

      String.toLowerCase() is currently used in:

      • StoryReporterBuilder.formatNames(boolean): should use the locale specified in the LocalizedKeywords to retrieve the name lower case. If not specified, it defaults to Locale.getDefault().
      • UnderscoredCamelCaseResolver: should provide a constructor to inject a non-default Locale

      String.toUpperCase() is currently used in:

      • PropertyWebDriverProvider: should provide a protected method usingLocale() which can be overridden use the desired Locale.

        Activity

        Mauro Talevi made changes -
        Field Original Value New Value
        Summary org.jbehave.core.reporters.StoryReporterBuilderBehaviour test fails StoryReporterBuilder.formatNames() should be locale-aware
        Issue Type Bug [ 1 ] Improvement [ 4 ]
        Fix Version/s 3.2 [ 16757 ]
        Affects Version/s 3.1.2 [ 16870 ]
        Description org.jbehave.core.reporters.StoryReporterBuilderBehaviour.shouldBuildWithReporterOfDifferentFormats test fails when I try to compile jbehave source with maven on my windows machine with Turkish locale. Consider to use "name = name.toLowerCase(java.util.Locale.ENGLISH);" instead of "name = name.toLowerCase();" at line 150 of org.jbehave.core.reporters.StoryReporterBuilder. In Turkish, there are two letters in order to symbolize English's I. They are I and İ (I with dot). Lower case of "I" is "ı" (i without dot) and lower case of "İ" (I with dot) is "i". Users from different nations may encounteer with this kind of problems. Add StoryReporterBuilder.formatNames(boolean, Locale) which defaults to formatNames(boolean, Locale.ENGLISH).

        Test case on Turkish locale:

        StoryReporterBuilderBehaviour.shouldBuildWithReporterOfDifferentFormats

        In Turkish, there are two letters in order to symbolize English's I. They are I and İ (I with dot). Lower case of "I" is "ı" (i without dot) and lower case of "İ" (I with dot) is "i". Users from different nations may encounter with this kind of problems.
        Component/s Core [ 11086 ]
        Mauro Talevi made changes -
        Assignee Mauro Talevi [ maurotalevi ]
        Mauro Talevi made changes -
        Description Add StoryReporterBuilder.formatNames(boolean, Locale) which defaults to formatNames(boolean, Locale.ENGLISH).

        Test case on Turkish locale:

        StoryReporterBuilderBehaviour.shouldBuildWithReporterOfDifferentFormats

        In Turkish, there are two letters in order to symbolize English's I. They are I and İ (I with dot). Lower case of "I" is "ı" (i without dot) and lower case of "İ" (I with dot) is "i". Users from different nations may encounter with this kind of problems.
        StoryReporterBuilder.formatNames(boolean) should use the locale specified in the LocalizedKeywords to retrieve the name lower case. If not specified, it defaults to Locale.getDefault().

        Test case on Turkish locale:

        StoryReporterBuilderBehaviour.shouldBuildWithReporterOfDifferentFormats

        In Turkish, there are two letters in order to symbolize English's I. They are I and İ (I with dot). Lower case of "I" is "ı" (i without dot) and lower case of "İ" (I with dot) is "i". Users from different nations may encounter with this kind of problems.
        Hide
        Mauro Talevi added a comment -

        Pushed a fix for this but could not yet complete the test in the Turkish locale.

        Could you please provide a version of the keyworks_xx.properties for the Turkish locale?

        Show
        Mauro Talevi added a comment - Pushed a fix for this but could not yet complete the test in the Turkish locale. Could you please provide a version of the keyworks_xx.properties for the Turkish locale?
        Mauro Talevi made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Mauro Talevi made changes -
        Priority Blocker [ 1 ] Major [ 3 ]
        Hide
        Muammer Yucel added a comment -

        Same problem exists at line 43 of org.jbehave.web.selenium.PropertyWebDriverProvider. It should be like :

        Browser browser = Browser.valueOf(Browser.class, System.getProperty("browser", "firefox").toUpperCase(java.util.Locale.ENGLISH));

        I think, each occurence of toUpperCases for "i" and toLowerCases for "I" should be taken into consideration.

        Show
        Muammer Yucel added a comment - Same problem exists at line 43 of org.jbehave.web.selenium.PropertyWebDriverProvider. It should be like : Browser browser = Browser.valueOf(Browser.class, System.getProperty("browser", "firefox").toUpperCase(java.util.Locale.ENGLISH)); I think, each occurence of toUpperCases for "i" and toLowerCases for "I" should be taken into consideration.
        Muammer Yucel made changes -
        Attachment keywords_tr.properties [ 53501 ]
        Hide
        Muammer Yucel added a comment -

        Lingual characteristics of Turkish are a bit different from English. For example, in opposition to English, adverbs and verbs take place at the end of sentences of Turkish. Because of this, simultaneous interpretation of keywords causes loss of meaning. So that, I tried to translate by considering real meanings of the keywords.

        Show
        Muammer Yucel added a comment - Lingual characteristics of Turkish are a bit different from English. For example, in opposition to English, adverbs and verbs take place at the end of sentences of Turkish. Because of this, simultaneous interpretation of keywords causes loss of meaning. So that, I tried to translate by considering real meanings of the keywords.
        Mauro Talevi made changes -
        Summary StoryReporterBuilder.formatNames() should be locale-aware Use of String.toUpper/LowerCase() should be locale-aware
        Description StoryReporterBuilder.formatNames(boolean) should use the locale specified in the LocalizedKeywords to retrieve the name lower case. If not specified, it defaults to Locale.getDefault().

        Test case on Turkish locale:

        StoryReporterBuilderBehaviour.shouldBuildWithReporterOfDifferentFormats

        In Turkish, there are two letters in order to symbolize English's I. They are I and İ (I with dot). Lower case of "I" is "ı" (i without dot) and lower case of "İ" (I with dot) is "i". Users from different nations may encounter with this kind of problems.
        In Turkish, there are two letters in order to symbolize English's I. They are I and İ (I with dot). Lower case of "I" is "ı" (i without dot) and lower case of "İ" (I with dot) is "i". Users from different nations may encounter with this kind of problems, which come to surface when using String.toUpper/LowerCase(). The solution is to use String.toUpper/LowerCase(Locale), while defaulting to Locale.getDefault() if none specified.

        String.toLowerCase() is currently used in:

        - StoryReporterBuilder.formatNames(boolean): should use the locale specified in the LocalizedKeywords to retrieve the name lower case. If not specified, it defaults to Locale.getDefault().
        - UnderscoredCamelCaseResolver: should provide a constructor to inject a non-default Locale

        String.toUpperCase() is currently used in:

        - PropertyWebDriverProvider: should provide a protected method toUpperCase(String) which can be overridden use the desired Locale.
        Component/s Web Selenium [ 14124 ]
        Component/s Core [ 11086 ]
        Mauro Talevi made changes -
        Component/s Core [ 11086 ]
        Mauro Talevi made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Fix Version/s web-3.2 [ 16758 ]
        Resolution Fixed [ 1 ]
        Mauro Talevi made changes -
        Description In Turkish, there are two letters in order to symbolize English's I. They are I and İ (I with dot). Lower case of "I" is "ı" (i without dot) and lower case of "İ" (I with dot) is "i". Users from different nations may encounter with this kind of problems, which come to surface when using String.toUpper/LowerCase(). The solution is to use String.toUpper/LowerCase(Locale), while defaulting to Locale.getDefault() if none specified.

        String.toLowerCase() is currently used in:

        - StoryReporterBuilder.formatNames(boolean): should use the locale specified in the LocalizedKeywords to retrieve the name lower case. If not specified, it defaults to Locale.getDefault().
        - UnderscoredCamelCaseResolver: should provide a constructor to inject a non-default Locale

        String.toUpperCase() is currently used in:

        - PropertyWebDriverProvider: should provide a protected method toUpperCase(String) which can be overridden use the desired Locale.
        In Turkish, there are two letters in order to symbolize English's I. They are I and İ (I with dot). Lower case of "I" is "ı" (i without dot) and lower case of "İ" (I with dot) is "i". Users from different nations may encounter with this kind of problems, which come to surface when using String.toUpper/LowerCase(). The solution is to use String.toUpper/LowerCase(Locale), while defaulting to Locale.getDefault() if none specified.

        String.toLowerCase() is currently used in:

        - StoryReporterBuilder.formatNames(boolean): should use the locale specified in the LocalizedKeywords to retrieve the name lower case. If not specified, it defaults to Locale.getDefault().
        - UnderscoredCamelCaseResolver: should provide a constructor to inject a non-default Locale

        String.toUpperCase() is currently used in:

        - PropertyWebDriverProvider: should provide a protected method usingLocale() which can be overridden use the desired Locale.

          People

          • Assignee:
            Mauro Talevi
            Reporter:
            Muammer Yucel
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: