#1 2024-11-25 06:27:09

ttminh
Member
Registered: 2024-11-25

Problem when execute report with Vietnamese text

Team great work on this product. but I have problem when try to execute report with Vietnamese text, it like no font added when execute report. I use report from Jasper report
FluxBB bbcode test

Offline

#2 2024-11-25 10:48:12

ttminh
Member
Registered: 2024-11-25

Re: Problem when execute report with Vietnamese text

Edit: I found why this problem exist: In MS SqlServer database => table 'RS_JASPER_REPORT_JRXML' => column 'content' => this column save data of  Jasper report file content and datatype of this column is varchar(max), so I can not save Vietnamese character in Jasper report file. When I try modified datatype of column 'content' => error when start ReportServer with Tomcat, I check with PostgreSql and see datatype of column 'content' is text (can save Vietnamese character), so it fine with PostgreSql but anyone have idea to resolve problem with MS Sqlserver? FluxBB bbcode testScreenshot-2024-11-25-175551.png

Last edited by ttminh (2024-11-25 10:56:32)

Offline

#3 2024-11-25 11:08:22

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Problem when execute report with Vietnamese text

Hi ttminh,

In MS SQL Server, the varchar(max) data type is designed to store non-Unicode data. Since Vietnamese characters are Unicode, varchar(max) cannot correctly handle them. This is why the content of your Jasper report file, which contains Vietnamese characters, is not being shown properly. In contrast, PostgreSQL's text data type supports Unicode, which is why it works fine in your PostgreSQL environment.

To resolve this issue in MS SQL Server, you need to change the column data type to one that supports Unicode:

Modify the content Column to Use nvarchar(max)

nvarchar(max) is the Unicode equivalent of varchar(max) in MS SQL Server and can handle Vietnamese characters.

ALTER TABLE RS_JASPER_REPORT_JRXML
ALTER COLUMN content NVARCHAR(MAX);

This change will allow the column to store Unicode characters, including Vietnamese text.

Also, please ensure your JDBC Url of your datasource contains "characterEncoding=UTF-8", e.g.:

url="jdbc:sqlserver://localhost:1433;databaseName=ReportServer;encrypt=true;trustServerCertificate=true;characterEncoding=UTF-8"

Regards,
Eduardo

Offline

#4 2024-11-26 10:21:00

ttminh
Member
Registered: 2024-11-25

Re: Problem when execute report with Vietnamese text

As I mentioned above, changing the data type of a column will cause an error when starting ReportServer with Tomcat: Schema-validation: wrong column type encountered in column [content] in table [RS_JASPER_REPORT_JRXML]; found [nvarchar (Types#NVARCHAR)], but expecting [varchar(max) (Types#LONGVARCHAR)]

Screenshot-2024-11-26-171736.png

Last edited by ttminh (2024-11-26 10:26:32)

Offline

#5 2024-11-26 10:29:46

ttminh
Member
Registered: 2024-11-25

Re: Problem when execute report with Vietnamese text

Is there any reason why the columns in SQL Server are varchar(max) instead of nvarchar(max)? I noticed that other columns, like 'Name', are also varchar(max), which causes Vietnamese characters to not be usable.

Offline

Board footer

Powered by FluxBB