0

devs, I am facing a simple issue, but I couldn't figure out the actual reason. I have a lot of reports in my ASP.NET Core 5 with angular 12 project. everything is rendered correctly except UNICODE Character.

see the below code example.

public static void Load(LocalReport report, decimal widgetPrice, decimal gizmoPrice) 
{ 
var items = new[] 
{ 
new ReportItem { Description = "Widget 6000 আমাদের A দেশের নাম বাংলাদেশ", Price = widgetPrice, Qty = 1 },
new ReportItem { Description = "Gizmo MAX", Price = gizmoPrice, Qty = 25 } 
};
var parameters = new[] { new ReportParameter("Title", "Invoice 4/2020") };
using var rs = Assembly.GetExecutingAssembly()
.GetManifestResourceStream("ReportViewerCore.Sample.AspNetCore.Reports.Report.rdlc");
report.LoadReportDefinition(rs); report.DataSources.Add(new ReportDataSource("Items", items));
report.SetParameters(parameters);
}

In the first ReportItem.Description= "Widget 6000 + some Unicode character in my language". when I print this in HTML, doc, and Xls, it renders everything well with Unicode. but in pdf, it ignores the characters or doesn't print properly the Unicode section. except for this, everything is okay.

Sraban75
  • 85
  • 9
  • Every character in .NET is a Unicode character. All characters in this page are Unicode characters. PDF doesn't support Unicode though and unless you tell it to use a specific font and codepage, won't be able to display *non-Latin* characters – Panagiotis Kanavos May 12 '22 at 15:38
  • Besides, what report engine did you use? .NET Core doesn't have any RDLC controls. The RDLC controls weren't even upgraded for ASP.NET MVC, much less .NET Core – Panagiotis Kanavos May 12 '22 at 15:40
  • @PanagiotisKanavos: "PDF doesn't support Unicode" is ... not exactly right. You can print any character you could ever wont in PDF. It might require picking the right font and/or tweaking some settings, but this is definitely not impossible in general. – Joachim Sauer May 12 '22 at 15:43
  • Those settings involve the character set. That's why we need to know how the file was generated, to see what settings can be used. The RDLC library was never migrated to ASP.NET Core so what is used here? A third-party control? – Panagiotis Kanavos May 12 '22 at 15:49
  • The problem was resolved by changing the font from "Arial" to "Nirmala UI". – Sraban75 Apr 09 '23 at 17:23

0 Answers0