JBehave
  1. JBehave
  2. JBEHAVE-957

Support for accented letters in step pattern placeholder names

    Details

    • Type: Improvement Improvement
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.8
    • Fix Version/s: 3.9, eclipse-1.0
    • Component/s: Core, Eclipse Support
    • Labels:
      None
    • Environment:
      Multi language
    • Number of attachments :
      9

      Description

      As it seems JBehave does not support multilanguage for parameter names.

      Unfortunately this Jira is not configured for umlauts, so I cannot paste the text into this ticket. See the first attached screenshot please for how the step looks like with umlauts.

      JBehave does not like the parameter names containing umlauts since they contain non-ASCII characters.

      This applies both to the Eclipse plugin and the core execution.

      Please see the attached screenshots which illustrate the problem.

      Can you please fix that so that umlauts are supported in JBehave parameter names?

      1. de_trader_is_alerted_of_status.geschüchte
        1 kB
        Otto Diesel
      2. DeSteps.java
        2 kB
        Otto Diesel
      3. DeStories.java
        0.6 kB
        Otto Diesel
      4. JBEHAVE-957.patch
        5 kB
        Otto Diesel
      1. language-problem-1.png
        10 kB
      2. language-problem-2.png
        3 kB
      3. language-problem-3.png
        2 kB
      4. language-problem-4.png
        13 kB
      5. language-problem-5.png
        5 kB

        Activity

        Otto Diesel made changes -
        Field Original Value New Value
        Description As it seems JBehave does not support multilanguage for parameter names.

        I tried this:

        {code}
            @When("ich $betrag $währung von Konto $lastkonto zu $gutschriftskonto $ausführung übertrage mit Zahlungsinfo $info")
            public void transfer(@Named("betrag") String amount,
                    @Named("währung") String currency,
                    @Named("lastkonto") String debitAccount,
                    @Named("gutschriftskonto") String creditAccount,
                    @Named("ausführung") String execution,
                    @Named("info") String paymentInformation) {
                // TODO
            }
        {code}

        JBehave does not like the parameter names "währung" and "ausführung" since they contain non-ASCII characters.

        This applies both to the Eclipse plugin and the core execution.

        Please see the attached screenshots which illustrate the problem.

        Can you please fix that so that umlauts are supported in JBehave parameter names?
        As it seems JBehave does not support multilanguage for parameter names.

        I tried this:

        {code}
            @When("ich $betrag $währung von Konto $lastkonto zu $gutschriftskonto $ausführung übertrage mit Zahlungsinfo $info")
            public void transfer(@Named("betrag") String amount,
                    @Named("währung") String currency,
                    @Named("lastkonto") String debitAccount,
                    @Named("gutschriftskonto") String creditAccount,
                    @Named("ausführung") String execution,
                    @Named("info") String paymentInformation) {
                // TODO
            }
        {code}

        JBehave does not like the parameter names "währung" and "ausführung" since they contain non-ASCII characters.

        This applies both to the Eclipse plugin and the core execution.

        Please see the attached screenshots which illustrate the problem.

        Can you please fix that so that umlauts are supported in JBehave parameter names?
        Otto Diesel made changes -
        Description As it seems JBehave does not support multilanguage for parameter names.

        I tried this:

        {code}
            @When("ich $betrag $währung von Konto $lastkonto zu $gutschriftskonto $ausführung übertrage mit Zahlungsinfo $info")
            public void transfer(@Named("betrag") String amount,
                    @Named("währung") String currency,
                    @Named("lastkonto") String debitAccount,
                    @Named("gutschriftskonto") String creditAccount,
                    @Named("ausführung") String execution,
                    @Named("info") String paymentInformation) {
                // TODO
            }
        {code}

        JBehave does not like the parameter names "währung" and "ausführung" since they contain non-ASCII characters.

        This applies both to the Eclipse plugin and the core execution.

        Please see the attached screenshots which illustrate the problem.

        Can you please fix that so that umlauts are supported in JBehave parameter names?
        As it seems JBehave does not support multilanguage for parameter names.

        Unfortunately this Jira is not configured for umlauts, so I cannot paste the text into this ticket. See the first attached screenshot please for how the step looks like with umlauts.

        JBehave does not like the parameter names containing umlauts since they contain non-ASCII characters.

        This applies both to the Eclipse plugin and the core execution.

        Please see the attached screenshots which illustrate the problem.

        Can you please fix that so that umlauts are supported in JBehave parameter names?
        Hide
        Mauro Talevi added a comment -

        Hi Otto,

        umlauts should be supported like any other unicode character. What you need to ensure is that the encoding is the same, and set to UTF-8.

        See the encoding section of: http://jbehave.org/reference/stable/stories-in-your-language.html

        The i18n example https://github.com/jbehave/jbehave-core/tree/master/examples/i18n shows that non-ASCII chars are supported.

        Show
        Mauro Talevi added a comment - Hi Otto, umlauts should be supported like any other unicode character. What you need to ensure is that the encoding is the same, and set to UTF-8. See the encoding section of: http://jbehave.org/reference/stable/stories-in-your-language.html The i18n example https://github.com/jbehave/jbehave-core/tree/master/examples/i18n shows that non-ASCII chars are supported.
        Hide
        Mauro Talevi added a comment -

        If you want to add a DE example to the ones in the i18n we can prove that DE chars are properly supported.

        Feel free to provide a patch that we can pull.

        Show
        Mauro Talevi added a comment - If you want to add a DE example to the ones in the i18n we can prove that DE chars are properly supported. Feel free to provide a patch that we can pull.
        Hide
        Otto Diesel added a comment -

        Hello Mauro,

        the encoding for the story and the Java step is already set to UTF-8.

        So it does not seem to be this cause. Besides this, umlauts are supported for step names by JBehave as long as they are not used in parameter names.

        In your i18n example which you mention above, umlauts are not used in the parameter names, so it does not prove that umlauts are supported in parameter names.

        Ok, I will then add a DE example to reproduce this bug.

        Show
        Otto Diesel added a comment - Hello Mauro, the encoding for the story and the Java step is already set to UTF-8. So it does not seem to be this cause. Besides this, umlauts are supported for step names by JBehave as long as they are not used in parameter names. In your i18n example which you mention above, umlauts are not used in the parameter names, so it does not prove that umlauts are supported in parameter names. Ok, I will then add a DE example to reproduce this bug.
        Hide
        Otto Diesel added a comment -

        I had to contribute the files like this since I could not create a patch and did not know which username and password I need for pushing it into the repository.

        Show
        Otto Diesel added a comment - I had to contribute the files like this since I could not create a patch and did not know which username and password I need for pushing it into the repository.
        Otto Diesel made changes -
        Attachment DeStories.java [ 64388 ]
        Attachment DeSteps.java [ 64389 ]
        Attachment de_trader_is_alerted_of_status.geschüchte [ 64390 ]
        Hide
        Otto Diesel added a comment -

        I attaches these files so that you can copy it into "jbehave-core/tree/master/examples/i18n" and can reproduce the issue and hopefully fix the bug:

        • DeStories.java
        • de_trader_is_alerted_of_status.geschüchte
        • DeSteps.java
        Show
        Otto Diesel added a comment - I attaches these files so that you can copy it into "jbehave-core/tree/master/examples/i18n" and can reproduce the issue and hopefully fix the bug: DeStories.java de_trader_is_alerted_of_status.geschüchte DeSteps.java
        Hide
        Mauro Talevi added a comment -

        The attachments have exactly the same encoding issues. Please contribute the patch via Git.

        To contribute a patch via github, you create your own account and fork the jbehave-core repo.

        http://jbehave.org/reference/stable/how-to-contribute.html

        Show
        Mauro Talevi added a comment - The attachments have exactly the same encoding issues. Please contribute the patch via Git. To contribute a patch via github, you create your own account and fork the jbehave-core repo. http://jbehave.org/reference/stable/how-to-contribute.html
        Hide
        Otto Diesel added a comment -

        I think you can easily fix that ecoding issues in a pragmatic way.

        But since it is important to me I will have to do it this way you want.

        Show
        Otto Diesel added a comment - I think you can easily fix that ecoding issues in a pragmatic way. But since it is important to me I will have to do it this way you want.
        Hide
        Otto Diesel added a comment -

        I couldn't yet manage to fork it, but I hope the patch file will do the job (see attachment).

        Show
        Otto Diesel added a comment - I couldn't yet manage to fork it, but I hope the patch file will do the job (see attachment).
        Otto Diesel made changes -
        Attachment JBEHAVE-957.patch [ 64399 ]
        Hide
        Otto Diesel added a comment -

        I spend a lot of time now doing what you demand from me so that you have it exacly as you want.

        The problem is that I cannot push it on the fork. It says: "https://github.com/OttoDiesel/jbehave-core.git: not authorized"

        I used my username and password which work when logging into the Github web page. But it did not work from Eclipse when I wanted to push it. I tried a lot of things and have googled a lot to find a solution.

        But: no success.

        Do you have an idea how I can solve this problem or are you willing to accept the patch I attached to this issue?

        Show
        Otto Diesel added a comment - I spend a lot of time now doing what you demand from me so that you have it exacly as you want. The problem is that I cannot push it on the fork. It says: "https://github.com/OttoDiesel/jbehave-core.git: not authorized" I used my username and password which work when logging into the Github web page. But it did not work from Eclipse when I wanted to push it. I tried a lot of things and have googled a lot to find a solution. But: no success. Do you have an idea how I can solve this problem or are you willing to accept the patch I attached to this issue?
        Hide
        Mauro Talevi added a comment -

        Hi Otto,

        In Github the workflow is:

        1. Login and clone repo, e.g. https://github.com/OttoDiesel/jbehave-core.git
        2. git clone https://github.com/OttoDiesel/jbehave-core.git
        3. commit patch to this repo
        4. git push

        Be aware that you cannot push from the repo you cloned from https://github.com/jbehave/jbehave-core.git.

        That said, the problem is I think elsewhere. Both the patch and the files do not render the DE chars correctly. E.g.

        Kommentar: Eigentlich müsste es "gehandelt" lauten, aber wir möchten Umlaute mitüberprüfen.

        I have no way of knowing what 'ü' is for example.

        What you could do is replace them with Unicode notations \uxxxx and then I translate them back.

        A question: I assume they render correctly for you in your files. But when you create the patch, are they still rendered correctly?

        The reason I wanted to pull from Git is that Git does a much better job at handling encoding.

        Thanks

        Show
        Mauro Talevi added a comment - Hi Otto, In Github the workflow is: 1. Login and clone repo, e.g. https://github.com/OttoDiesel/jbehave-core.git 2. git clone https://github.com/OttoDiesel/jbehave-core.git 3. commit patch to this repo 4. git push Be aware that you cannot push from the repo you cloned from https://github.com/jbehave/jbehave-core.git . That said, the problem is I think elsewhere. Both the patch and the files do not render the DE chars correctly. E.g. Kommentar: Eigentlich müsste es "gehandelt" lauten, aber wir möchten Umlaute mitüberprüfen. I have no way of knowing what 'ü' is for example. What you could do is replace them with Unicode notations \uxxxx and then I translate them back. A question: I assume they render correctly for you in your files. But when you create the patch, are they still rendered correctly? The reason I wanted to pull from Git is that Git does a much better job at handling encoding. Thanks
        Hide
        Otto Diesel added a comment -

        Hello Mauro,

        I had the same problem with my browser concerning these umlauts.

        If you change browser encoding to UTF-8 you will see the umlauts correctly. The text files which I have attached are all encoded in UTF-8. Can you please try that?

        The files render correctly. Using Unicode notations seems not suitable for reproducing the issue since it cannot be applied in story files I think and because we want to use umlauts and no Unicode notations.

        I know the Github workflow now, but the problem is elsewhere. I cannot commit the patch to my repo because it says: "https://github.com/OttoDiesel/jbehave-core.git: not authorized"

        I wished you could help me on this. As I said, I tried a lot of things, none worked.

        Show
        Otto Diesel added a comment - Hello Mauro, I had the same problem with my browser concerning these umlauts. If you change browser encoding to UTF-8 you will see the umlauts correctly. The text files which I have attached are all encoded in UTF-8. Can you please try that? The files render correctly. Using Unicode notations seems not suitable for reproducing the issue since it cannot be applied in story files I think and because we want to use umlauts and no Unicode notations. I know the Github workflow now, but the problem is elsewhere. I cannot commit the patch to my repo because it says: "https://github.com/OttoDiesel/jbehave-core.git: not authorized" I wished you could help me on this. As I said, I tried a lot of things, none worked.
        Hide
        Cristiano Gavião added a comment -

        Otto, seems that you didn't set the SHH keys. check how to set it here. https://help.github.com/articles/generating-ssh-keys

        Show
        Cristiano Gavião added a comment - Otto, seems that you didn't set the SHH keys. check how to set it here. https://help.github.com/articles/generating-ssh-keys
        Hide
        Otto Diesel added a comment -

        I cannot use SSH in our company since they block SSH communication. I also cannot go directly into the internet but have to use a company proxy.

        They have a very high security since it is a huge financial company using SVN. It is not so easy to contribute something to Github from my place of work.

        I will have to see if I can solve that somehow.

        Show
        Otto Diesel added a comment - I cannot use SSH in our company since they block SSH communication. I also cannot go directly into the internet but have to use a company proxy. They have a very high security since it is a huge financial company using SVN. It is not so easy to contribute something to Github from my place of work. I will have to see if I can solve that somehow.
        Hide
        Mauro Talevi added a comment -

        Got the resources forcing UTF-8 encoding in the browser (but best to sort out the commit rights to Github from non-work locations for future contributions).

        Added the DE story to i18n example. It is now working with two provisos:

        1. You cannot use non-standard coding chars in the $-prefix patterns. These are technical internal variables that indicate placeholders and not part of the textual story. You can use umlauts and other non-standard coding chars in the @Named annotations. These can be reflected in the textual story.
        2. I've removed the umlaut from the path of the file. This is something that is outside the scope of JBehave.

        Please pull latest and verify it works for you.

        Show
        Mauro Talevi added a comment - Got the resources forcing UTF-8 encoding in the browser (but best to sort out the commit rights to Github from non-work locations for future contributions). Added the DE story to i18n example. It is now working with two provisos: 1. You cannot use non-standard coding chars in the $-prefix patterns. These are technical internal variables that indicate placeholders and not part of the textual story. You can use umlauts and other non-standard coding chars in the @Named annotations. These can be reflected in the textual story. 2. I've removed the umlaut from the path of the file. This is something that is outside the scope of JBehave. Please pull latest and verify it works for you.
        Mauro Talevi made changes -
        Fix Version/s 3.9 [ 19035 ]
        Affects Version/s 4.0 [ 18486 ]
        Hide
        Otto Diesel added a comment -

        It seems not to be working as I requested. My motivation for this issue was not to provide JBheave a new regression test but to reproduce my issue so that it might be fixed. If you had refused to fix that, I would not had bothered providing sources so that it can be reproduced.

        I still cannot use umlauts in parameter names, so it is not better than before to me.

        You changed the parameter name from "sümbol" (please change browser encoding to UTF-8 if you can't see the char correctly) to "symbol".

        But I inteded to use German paramter names. Sometimes German parameter names contain umlauts. I hoped you can make it work to use umlauts.

        In your changed German example the story writer will see English ASCII parameter names in a German step name. Is this good to mix two languages in a story file? I thinkt it is not optimal.

        Besides that I don't know exactly what you mean with "1. You cannot use non-standard...". Why can't it be used there? Is Java prohibiting it or JBehave? Even if I use @Named("sümbol"), it does not work.

        Show
        Otto Diesel added a comment - It seems not to be working as I requested. My motivation for this issue was not to provide JBheave a new regression test but to reproduce my issue so that it might be fixed. If you had refused to fix that, I would not had bothered providing sources so that it can be reproduced. I still cannot use umlauts in parameter names, so it is not better than before to me. You changed the parameter name from "sümbol" (please change browser encoding to UTF-8 if you can't see the char correctly) to "symbol". But I inteded to use German paramter names. Sometimes German parameter names contain umlauts. I hoped you can make it work to use umlauts. In your changed German example the story writer will see English ASCII parameter names in a German step name. Is this good to mix two languages in a story file? I thinkt it is not optimal. Besides that I don't know exactly what you mean with "1. You cannot use non-standard...". Why can't it be used there? Is Java prohibiting it or JBehave? Even if I use @Named("sümbol"), it does not work.
        Hide
        Mauro Talevi added a comment -

        You asked to verify that parameter names could be used with umlauts, and that is done.

        The $-prefixed name used in the patterns are not parameter names, just placeholders, and bear no connection to names (although most people tend to use the same name).

        Currently, the regex-based pattern parser does not recognise the chars with accents as words (regex \w). Can you provide an example of a regex that matches words with accents in German?

        Show
        Mauro Talevi added a comment - You asked to verify that parameter names could be used with umlauts, and that is done. The $-prefixed name used in the patterns are not parameter names, just placeholders, and bear no connection to names (although most people tend to use the same name). Currently, the regex-based pattern parser does not recognise the chars with accents as words (regex \w). Can you provide an example of a regex that matches words with accents in German?
        Hide
        Mauro Talevi added a comment -

        I've found the "Letter" category which can be used to match any ASCII unicode letter (http://www.regular-expressions.info/unicode.html#category).

        So the accented chars can be allowed in step patterns placeholder names.

        Show
        Mauro Talevi added a comment - I've found the "Letter" category which can be used to match any ASCII unicode letter ( http://www.regular-expressions.info/unicode.html#category ). So the accented chars can be allowed in step patterns placeholder names.
        Mauro Talevi made changes -
        Summary No umlaut support for parameter names No umlaut support for step pattern placeholder names
        Assignee Mauro Talevi [ maurotalevi ]
        Mauro Talevi made changes -
        Summary No umlaut support for step pattern placeholder names Support for accented letters in step pattern placeholder names
        Issue Type Bug [ 1 ] Improvement [ 4 ]
        Mauro Talevi made changes -
        Component/s Eclipse Support [ 15582 ]
        Mauro Talevi made changes -
        Fix Version/s eclipse-1.0 [ 18652 ]
        Component/s Eclipse Support [ 15582 ]
        Mauro Talevi made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Mauro Talevi
            Reporter:
            Otto Diesel
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: