You are not logged in.
Pages: 1
I am new to Delphi SynMustache and I want to use it in some very important projects. So I've tryed to play a little bit more with templates and it seems that there is a problem with parsing from templates with non englisch texts. I mean special symbols from german language for example, like "ä", "ß", "ö" ...
To be more specific:
procedure TForm2.RenderTemplate;
var
mustache: TSynMustache;
jsonUFT16: string;
templateUTF16: string;
jsonUTF8: RawUTF8;
templateUTF8: RawUTF8;
jsonRBS: RawByteString;
templateRBS: RawByteString;
htmlOutput: string;
begin
memOutput.Lines.Clear;
// don't work for us
memOutput.Lines.Add('Output using RawUTF8');
templateUTF8 := memTemplate.Text;
mustache := TSynMustache.Parse(templateUTF8);
jsonUTF8 := memJSON.Text;
htmlOutput := mustache.RenderJSON(jsonUTF8);
memOutput.Lines.Add(htmlOutput);
memOutput.Lines.Add('');
// work for us
memOutput.Lines.Add('Output using RawByteString');
templateRBS := memTemplate.Text;
mustache := TSynMustache.Parse(templateRBS);
jsonRBS := memJSON.Text;
htmlOutput := mustache.RenderJSON(jsonRBS);
memOutput.Lines.Add(htmlOutput);
end;
So if I use RawByteString everything seems to be ok, but I'm not sure if that is the right way to go. Property "Template" is ok after parsing, but Tags doesn't recognise code page correctly and at end the result is not as awaited to be.
Is this possible bug or I'm doing something wrong?
Offline
ok! Now it works with stringtoUTF8 and UTF8tostring. Just fine! Thank you!
Why don't you mention it in documentation for SynMustache?
Offline
Pages: 1