## 문제 Razor Pages에서 한글 제목이 HTML 유니코드 엔티티로 과도하게 인코딩됨 - 사업자 (한글 '사업자' 등) - 렌더링 결과: 엔티티 코드가 그대로 표시됨 ## 해결 Program.cs에서 WebEncoderOptions 설정 - TextEncoderSettings: UnicodeRanges.All 적용 - 한글 및 다국어 문자를 유니코드 엔티티로 변환하지 않음 - XSS 보호는 유지 (필요시 @Html.Raw() 사용) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Text.Encodings.Web;
|
||||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||||
using MudBlazor.Services;
|
using MudBlazor.Services;
|
||||||
using TaxBaik.Application;
|
using TaxBaik.Application;
|
||||||
@@ -17,6 +18,12 @@ builder.Services.AddRazorComponents()
|
|||||||
.AddInteractiveServerComponents();
|
.AddInteractiveServerComponents();
|
||||||
builder.Services.AddMudServices();
|
builder.Services.AddMudServices();
|
||||||
builder.Services.AddMemoryCache();
|
builder.Services.AddMemoryCache();
|
||||||
|
|
||||||
|
// 한글 포함 다국어 문자를 유니코드 엔티티로 변환하지 않도록 설정
|
||||||
|
builder.Services.Configure<WebEncoderOptions>(opts => {
|
||||||
|
opts.TextEncoderSettings = new TextEncoderSettings(UnicodeRanges.All);
|
||||||
|
});
|
||||||
|
|
||||||
builder.Services.AddInfrastructure();
|
builder.Services.AddInfrastructure();
|
||||||
builder.Services.AddApplication();
|
builder.Services.AddApplication();
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
|
using System.Text.Encodings.Web;
|
||||||
using Microsoft.AspNetCore.ResponseCompression;
|
using Microsoft.AspNetCore.ResponseCompression;
|
||||||
using TaxBaik.Application;
|
using TaxBaik.Application;
|
||||||
using TaxBaik.Infrastructure;
|
using TaxBaik.Infrastructure;
|
||||||
@@ -10,6 +11,12 @@ builder.Services.AddMemoryCache();
|
|||||||
builder.Services.AddResponseCompression(opts => {
|
builder.Services.AddResponseCompression(opts => {
|
||||||
opts.Providers.Add<GzipCompressionProvider>();
|
opts.Providers.Add<GzipCompressionProvider>();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 한글 포함 다국어 문자를 유니코드 엔티티로 변환하지 않도록 설정
|
||||||
|
builder.Services.Configure<WebEncoderOptions>(opts => {
|
||||||
|
opts.TextEncoderSettings = new TextEncoderSettings(UnicodeRanges.All);
|
||||||
|
});
|
||||||
|
|
||||||
builder.Services.AddInfrastructure();
|
builder.Services.AddInfrastructure();
|
||||||
builder.Services.AddApplication();
|
builder.Services.AddApplication();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user