@Atir_Tahir
We got an additional question from the user.
Converting a CSV file with the character code SJIS to PDF in the ASP.NET Core 3.1 environment causes garbled characters.
When the user ran her LoadOptions.Encoding with SJIS, an exception occurred in the GroupDocs.Viewer.View method. Is SJIS not supported ?
(System.Text.Encoding.CodePages is already installed.)
Attach the content and source of the error.
error.zip (13.1 KB)
Best regards Shin.
@xlsoftkk
Could you please share the sample code and the API version (e.g. 20.10, 22.1) that you are using?
@Atir_Tahir
The sample code was in the file I sent earlier.
It is described below.
LoadOptions loadOptions = new LoadOptions();
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
loadOptions.Encoding = Encoding.GetEncoding(“shift-jis”);
using (var input = new MemoryStream(file))
using (var viewer = new Viewer(input, loadOptions))
using (var stream = new MemoryStream())
{
}
The API version will ask the user.
Best regards Shin.
@xlsoftkk
We’ve reproduced this issue on our side. It happens because Viewer can’t properly detect the file type from a stream. Please set the file type to fix the issue loadOptions.FileType = FileType.FromFilePath(fileName);
System.Text.Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
LoadOptions loadOptions = new LoadOptions();
loadOptions.Encoding = Encoding.GetEncoding("Shift-JIS");
loadOptions.FileType = FileType.FromFilePath(fileName);
byte[] bytes = File.ReadAllBytes(fileName);
using (MemoryStream input = new MemoryStream(bytes))
using (Viewer viewer = new Viewer(input, loadOptions))
{
PdfViewOptions viewOptions = new PdfViewOptions();
viewer.View(viewOptions);
}
@vladimir.litvinchik
Thank you for your response.
I will tell the user.
Best regards Shin.
@xlsoftkk
Please also note that rendering SJIS encoded CSV files requires installing additional fonts. As an example, on Ubuntu you can intall fonts-takao-gothic
fonts with apt-get install -y fonts-takao-gothic
.
@vladimir.litvinchik
Thank you for contacting us.
I will tell the user.
Best regards Shin.
@vladimir.litvinchik
I got a reply from the user.
The user was also able to confirm the conversion with SJIS.
And the user was using version 22.5 of his API.
Please continue to investigate CONVERSIONNET-5227.
Best regards Shin.