Chungyen Tsai
Chungyen Tsai

Reputation: 31

Problem showing chinese in the browser with OpenXava

I'm using Windows 10, OpenXava 6.6.3

I was trying to create some products but when i save product name in Chinese simplified, my browser shows ????? in some characters.

the screenshot

I tried to set Hibernate to read and save in utf-8 but no result. Original Hibernate cfg.xml

<hibernate-configuration>

    <session-factory>

        <property name="hibernate.connection.datasource">java://comp/env/jdbc/InvoicingDS</property>
        <property name="hibernate.jdbc.use_get_generated_keys">false</property>     
        <property name="hibernate.show_sql">false</property>
        <property name="hibernate.default_schema">Invoicing</property>  
            
        <!-- GalleryImage is needed only if you uses IMAGES_GALLERY/GALERIA_IMAGENES stereotype -->
        <mapping resource="GalleryImage.hbm.xml"/>
        
    </session-factory>
    
</hibernate-configuration>

Also tried in several browsers too, restart OpenXava, but the problem persists.

Product Class

package com.yourcompany.invoicing.model;

import java.math.*;

import javax.persistence.*;

import org.openxava.annotations.*;

import lombok.*;

@Entity
@Getter
@Setter
public class Product {

    @Id
    @Column(length = 9)
    int number;

    @Column(length = 50)
    @Required
    String description;

    @ManyToOne( 
            fetch = FetchType.LAZY, 
            optional = true) 
    @DescriptionsList 
    Category category; 

    @Stereotype("MONEY") 
    BigDecimal price; 

    @Stereotype("IMAGES_GALLERY") 
    @Column(length = 32) 
    String photos;

    @Stereotype("MEMO") 
    String remarks;

}

Upvotes: 0

Views: 76

Answers (1)

Chungyen Tsai
Chungyen Tsai

Reputation: 31

On OpenXava toolbar, you must go to

Run > Run Configurations > on the right side, tab Arguments > VM Arguments

then put

-Dfile.encoding=UTF-8

Many times the language you use is different from the encoding that windows has, that's why it appears ?????

For example, Windows with traditional Chinese, the encoding is MS950 and Simplified Chinese is MS936.

Upvotes: 1

Related Questions