Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Roo 1.1.0 release - Problem with UTF8 (german and cyrillic)

  1. #1
    Join Date
    Aug 2010
    Posts
    4

    Default Roo 1.1.0 release - Problem with UTF8 (german and cyrillic)

    Hello,

    I use the roo-1.1.0 release and have same problem with

    a) german special characters (ö,ä,ß,ü)
    b) cyrillic characters (щвды...)

    See attached screenshots.

    Here are the commands for setup of roo project

    project --topLevelPackage test.test
    persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY

    What can I change? Thanks.


    See also https://jira.springsource.org/browse...2#action_60102
    Attached Images Attached Images

  2. #2
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    This is a database setup issue. I would guess HSQLDB does not use UTF-8 encoding out of the box. Can you try with a persistent database like MySQL which has character encoding of UTF-8?

    HTH,
    Stefan
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

  3. #3
    Join Date
    Aug 2010
    Posts
    4

    Default

    I changed the persistence from memory hsqldb to file hsqldb
    Code:
    persistence setup --provider HIBERNATE --database HYPERSONIC_PERSISTENT
    in order to see what is in the db file, because I have same application in Grails and in Roo.
    There is no problems in Grails with the german or cyrillic charachters, see attached file.

    Here are the results:

    Grails:
    Entered value Привет München,
    value in the file db INSERT INTO GUETER_EINHEIT VALUES(17,0,'\u041f\u0440\u0438\u0432\u0435\u0442 M\u00fcnchen')


    Roo:
    Entered value привет münchen,
    value in the file db INSERT INTO GUETER_EINHEIT VALUES(2,'\u00d0\u009f\u00d1\u0080\u00d0\u00b8\u00d0\u00b2\ u00d0\u00b5\u00d1\u0082 m\u00c3\u00bcnchen',0)


    Very strange, I see in Roo for one "special character" two unicode characters and the unicode is different?


    Same db settings in Grails and Roo

    Code:
    hsqldb.script_format=0
    runtime.gc_interval=0
    sql.enforce_strict_size=false
    hsqldb.cache_size_scale=8
    readonly=false
    hsqldb.nio_data_file=true
    hsqldb.cache_scale=14
    version=1.8.0
    hsqldb.default_table_type=memory
    hsqldb.cache_file_scale=1
    hsqldb.log_size=200
    modified=yes
    hsqldb.cache_version=1.7.0
    hsqldb.original_version=1.8.0
    hsqldb.compatible_version=1.8.0

    Some ideas? Thanks
    Attached Images Attached Images

  4. #4
    Join Date
    Aug 2010
    Posts
    4

    Default

    I copied the correct enty from grails hsqldb to roo hsqldb and started the roo aap. again and the entry is showed correctly.

    So the db settings should be ok.

  5. #5
    Join Date
    Aug 2010
    Posts
    4

  6. #6
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    I committed a fix that works in my test environment. It would be great if someone could confirm this by using a source build.
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

  7. #7

    Default

    Hello,
    I had the same problem. Thanks to Stefan Schmidt. I have solved this problem by make CharacterEncodingFilter to the first of filters:
    Code:
    ...
    <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath*:META-INF/spring/applicationContext*.xml</param-value>
        </context-param>
        
        <filter>
            <filter-name>CharacterEncodingFilter</filter-name>
            <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
            <init-param>
                <param-name>encoding</param-name>
                <param-value>UTF-8</param-value>
            </init-param>
            <init-param>
                <param-name>forceEncoding</param-name>
                <param-value>true</param-value>
            </init-param>
        </filter>
        
        <filter>
            <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
            <filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
        </filter>
    ... (other filters)
    But I'm also have similar problem with encoding values, that comes from @ModelAttribute method in controller.

    The code below.
    In controller:
    Code:
        @ModelAttribute("russianWord")
        public String populateRussianWord() {
            return "Привет";
        }
    In the view:
    Code:
    <spring:eval expression="russianWord" />
    The result is "Привет", but must be "Привет".

    I'm use Roo 1.1.0 RELEASE, Tomcat 6, Windows XP. All file encoding is UTF-8.

  8. #8

  9. #9

    Default

    I resolve this problem by adding "<encoding>UTF-8</encoding>" to pom.xml file in the "maven-compiler-plugin" group.

    Now my pom.xml look's like this:
    ...
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.1</version>
    <configuration>
    <source>1.6</source>
    <target>1.6</target>
    <encoding>UTF-8</encoding>
    </configuration>
    </plugin>

    I think that Roo must add this line by default.

  10. #10
    Join Date
    Nov 2010
    Posts
    6

    Default

    I've also modified my pom.xml according to your advice but that didn't fix the issue with non-WesternEuropean characters.
    Did you roll back all the other changes mentioned in your previous posts (e.g. CharacterEncodingFilter) and left with changed pom only?

    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •