diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-06-07 20:40:48 +0200 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-06-07 20:40:48 +0200 |
| commit | a0f1e0e9db4b0edee45018c47a08761916af0ce6 (patch) | |
| tree | dc9d05f5772442f61ec913631540b24cf67d5e8a /UViewer.pas | |
| parent | ecde167da74c86bc047aaf84c5e548cf65a5da98 (diff) | |
| download | tuxcmd-0.6.38.tar.xz | |
Revised UTF-8 filenames supportv0.6.38
Diffstat (limited to 'UViewer.pas')
| -rw-r--r-- | UViewer.pas | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/UViewer.pas b/UViewer.pas index d7d1c4c..70d3a64 100644 --- a/UViewer.pas +++ b/UViewer.pas @@ -393,19 +393,23 @@ begin Valid := True; for i := 0 to LineBuffer.Count - 1 do begin - Valid := Valid and g_utf8_validate(PChar(LineBuffer[i]), -1, nil); - if not Valid then Break; + Valid := Valid and g_utf8_validate(PChar(LineBuffer[i]), Length(LineBuffer[i]), nil); + if not Valid then begin + DebugMsg(['** TFViewer.LoadFile(', FileName, ', Line ', i + 1, ') is not UTF-8 valid.']); + Break; + end; end; - + if Valid then TextView.Lines.SetText(LineBuffer.Text) - else + else begin for i := 0 to LineBuffer.Count - 1 do TextView.Lines.InsertText(AnsiToUtf8(LineBuffer[i]) + #10); + end; { LineHeight := 16; NumLines := LineBuffer.Count; } - Caption := Format('TuxView [%s]', [ANSIToUTF8(FileName)]); + Caption := Format('TuxView [%s]', [StrToUTF8(FileName)]); // FDrawingArea.SetSizeRequest(-1, NumLines * LineHeight); Result := True; except |
