Garbled characters printed by fpImageCanvas.TextOut method lazarus / 21-General ---------------------------------------------------------------------- PeterHu · 2025-07-30 14:05 following https://wiki.freepascal.org/fcl-image the fontdraw example works as expected.When I changed the text string to Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i const  text_str='Hello world!'+                    'こんにちは世界!'+                  '你好世界!' +                    'नमस्ते दुनिया!'+                    '👋 🌎 !';    Remarks: the last three character of the above string is 👋🌎! but I don't know why the webpage shows like that. the output png file shows garbled characters after "Hello world!".Please see below screen shot. 【Edit】I have already set {$codepage utf8} and also add lazutf8 unit to the project. But when I tried TPicture,the saving png file shows proper characters. Code: [Select]Image := TPicture.Create();   Image.PNG.SetSize(1024, 256);   with Image.PNG.Canvas do begin     Brush.Color := TColor($F7F4F0);     Brush.Style := bsSolid;     FillRect(0, 0, Image.Width, Image.Height);     Font.Color := clTeal;     Font.Name := 'DejaVuSans';     Font.Height :=20;     TextOut(16, 96, Text);   end;   // Save & destroy image   Image.SaveToFile('test.png');   Image.Free();        So was I missing somthing? ---------------------------------------------------------------------- Thaddy · 2025-07-30 16:03 Needs utf8 enabled console or terminal: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$codepage utf8}const  text_str='Hello world!'+                    'こんにちは世界!'+                  '你好世界!' +                    'नमस्ते दुनिया!'+                  #128075+#127758+'!';  begin  writeln(text_str)end. Is that what you expected?? Note the little changes I made in your code. BTW the last two are neat! I store that in memory.. ---------------------------------------------------------------------- PeterHu · 2025-07-31 00:39 Sorry I forgot to mention I have set {$codepage utf8} and also add lazutf8 unit in the project.Normally when I finished these two steps freepascal and lazarus have done a great job on asian character diplay (than many other languages do I once tried on this aspect  ),but not this time with fpImageCanvas.TextOut. ---------------------------------------------------------------------- PeterHu · 2025-08-02 08:29 Just found TBGRABitmap works great with this issue.Need to mention,from the wikihttps://wiki.freepascal.org/BGRABitmap: QuoteThe main class is TBGRABitmap, which is derived from TFPCustomImage. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program project1;uses  sysutils,bgraBitmap,bgraBitmapTypes,interfaces; const  text_str='Hello, world!¡Hola Mundo!Γειά σου Κόσμε!Привет, мир!こんにちは世界!नमस्ते दुनिया!👋🌎!';procedure test;var  bmp: TBGRABitmap;begin  bmp := TBGRABitmap.Create(1024, 330, BGRAWhite);   bmp.FontHeight := 16;   bmp.textout(30,30,text_str,BgraBlack);  bmp.SaveToFile('DrawText.png');  bmp.Free;end; begin   test;  readln; end.