Skip to content

Commit

Permalink
fix: Outputted PDF displays garbled characters when name contains non…
Browse files Browse the repository at this point in the history
…-ASCII chars (#9769)

fix: PDF displays garbled characters
  • Loading branch information
filzrev authored Mar 8, 2024
1 parent d519bb4 commit 16c90f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Docfx.App/PdfBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Reflection;
using System.Text;
using System.Text.Json;
using Docfx.Build;
using Docfx.Common;
Expand Down Expand Up @@ -137,7 +138,7 @@ await CreatePdf(
IResult TocPage(string url)
{
var pageNumbers = pdfPageNumbers.TryGetValue(url, out var x) ? x : default;
return Results.Content(TocHtmlTemplate(new Uri(baseUrl!, url), pdfTocs[url], pageNumbers).ToString(), "text/html");
return Results.Content(TocHtmlTemplate(new Uri(baseUrl!, url), pdfTocs[url], pageNumbers).ToString(), "text/html", Encoding.UTF8);
}

async Task<byte[]?> PrintPdf(Outline outline, Uri url)
Expand Down
2 changes: 2 additions & 0 deletions src/docfx/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"commandLineArgs": "pdf ../../samples/seed/docfx.json",
"workingDirectory": ".",
"environmentVariables": {
"DOCFX_PDF_TIMEOUT": "0"
}
},
// Run `docfx download` command.
Expand All @@ -56,6 +57,7 @@
"commandLineArgs": "../../samples/seed/docfx.json",
"workingDirectory": ".",
"environmentVariables": {
"DOCFX_PDF_TIMEOUT": "0"
}
}
}
Expand Down

0 comments on commit 16c90f6

Please sign in to comment.