Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Encoding. Localization, especially Ru language #465

Open
AndreyMisnikov opened this issue Jan 20, 2022 · 2 comments
Open

Issue with Encoding. Localization, especially Ru language #465

AndreyMisnikov opened this issue Jan 20, 2022 · 2 comments

Comments

@AndreyMisnikov
Copy link

AndreyMisnikov commented Jan 20, 2022

Hello!

If I define razor light engine as
RazorLightEngine engine = new RazorLightEngineBuilder()
.UseEmbeddedResourcesProject(typeof(RazorModel))
.SetOperatingAssembly(typeof(RazorModel).Assembly)
.UseMemoryCachingProvider()
.Build();

and then use
engine.CompileRenderStringAsync(razorTemplateKey, content, model)

I have the issue with encoding when my content contains Russian.
Is it possible to specify some kind of encoding for Engine by default?

I have created a lot of templates in my project with localization and as temporary fix I use
content = "@using RazorLight @{ DisableEncoding = true; }" + content;

I would like to have an option to set some property to engine and be able to work with any language.

@jzabroski
Copy link
Collaborator

What you are describing as a temporary fix is the de facto approach:

https://github.com/toddams/RazorLight#encoding

If you want to contribute an alternative approach, I am open to shipping a PR.

@jzabroski
Copy link
Collaborator

@AndreyMisnikov any feedback/thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants