Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
accented char
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
QGradientTrackPanel: A Fu...
by
Ed78z
[
Today
at 01:24:17 am]
Solved: Picture Framer (R...
by
Boleeman
[
Today
at 12:20:27 am]
Why does Free Pascal use ...
by
creaothceann
[August 16, 2026, 11:26:45 pm]
Lazarus Vs Codetyphon
by
BSaidus
[August 16, 2026, 09:59:46 pm]
Proper name for free meth...
by
jamie
[August 16, 2026, 09:54:48 pm]
MR - DebuggerIntf for ter...
by
Martin_fr
[August 16, 2026, 08:21:29 pm]
Is it possible to communi...
by
Warfley
[August 16, 2026, 08:15:43 pm]
array values as reference
by
jamie
[August 16, 2026, 07:58:57 pm]
LRS Explorer
by
Xenno
[August 16, 2026, 07:27:54 pm]
[Solved] The use of EXIT ...
by
440bx
[August 16, 2026, 07:27:20 pm]
TEDit PasswordChar not wo...
by
Hansaplast
[August 16, 2026, 05:19:01 pm]
Which Linux version
by
cdbc
[August 15, 2026, 08:28:37 pm]
[Qt5/Qt6] JPSupport-Qt: J...
by
shortcut
[August 15, 2026, 08:19:29 pm]
FpDebug: Bugs and API gap...
by
Martin_fr
[August 15, 2026, 08:07:50 pm]
BS Controls – Silly Compo...
by
Xenno
[August 15, 2026, 07:40:44 pm]
Adding persistent fields ...
by
LemonParty
[August 15, 2026, 05:47:05 pm]
Synedit wordwrap
by
Martin_fr
[August 15, 2026, 05:37:57 pm]
TlsLib4Pascal
by
Thaddy
[August 15, 2026, 05:27:52 pm]
Unleashed Pascal (async/a...
by
chamfay
[August 15, 2026, 10:35:09 am]
TDWEdit
by
docno
[August 15, 2026, 10:12:10 am]
var vs out (including "co...
by
440bx
[August 15, 2026, 08:42:28 am]
Local AI LLM Wrapper Demo...
by
edwinyzh
[August 15, 2026, 05:30:15 am]
Trndi 16 is released
by
slicke
[August 15, 2026, 03:06:44 am]
Clean up and build
by
n7800
[August 14, 2026, 11:03:28 pm]
'ReadStr' ?
by
PascalDragon
[August 14, 2026, 08:33:34 pm]
« previous
next »
Print
Pages:
1
[
2
]
Author
Topic: accented char (Read 10749 times)
Paolo
Hero Member
Posts: 770
Re: accented char
«
Reply #15 on:
August 10, 2021, 02:23:16 pm »
thanks engkin,
however in the real situation the file is just one file, say "prova.pas", as soon as possible I'll try to verify "who" or "what" make the file different...
Logged
engkin
Hero Member
Posts: 3112
Re: accented char
«
Reply #16 on:
August 10, 2021, 05:29:32 pm »
You can check if a string is a valid UTF8 string by using FindInvalidUTF8Codepoint from unit LazUtf8, as in:
Code: Pascal
[Select]
[+]
[-]
uses
...
LazUtf8
;
..
s
:
string
;
p
:
PtrInt
;
begin
s
:
=
'ab'
#
$88
'cd'
;
//<--- not valid because of the #$88
p
:
=
FindInvalidUTF8Codepoint
(
@
s
[
1
]
,
Length
(
s
)
,
True
)
;
if
p<>
-
1
then
//NOT Valid
If your code is for your personal use, or limited to one ANSI codepage, you can use WinCPToUTF8 to correct the string. Otherwise you can provide some mean for the user to choose the correct codepage.
Logged
Print
Pages:
1
[
2
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
accented char
TinyPortal
© 2005-2018