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
Hashing pointers by using...
by
EganSolo
[
Today
at 10:44:45 pm]
project - count source li...
by
bobonwhidbey
[
Today
at 10:30:31 pm]
Recomendations for conver...
by
BlueIcaro
[
Today
at 09:49:20 pm]
FPC 3.2.4-rc1 available
by
PeterBB
[
Today
at 08:31:32 pm]
fpsockets error: 10047
by
parcel
[
Today
at 04:03:56 pm]
So many "newbies"
by
Joanna
[
Today
at 02:52:06 pm]
Is it possible to run "mo...
by
Thausand
[
Today
at 02:42:56 pm]
TIBDataSet "Closing"? on ...
by
RedOctober
[
Today
at 02:38:05 pm]
TLazSerial : serial port ...
by
CM630
[
Today
at 02:20:24 pm]
connecting to mariadb
by
alanyoung
[
Today
at 01:27:11 pm]
How to get the standard m...
by
stem
[
Today
at 12:50:55 pm]
Lookup field: error list ...
by
BlueIcaro
[
Today
at 12:00:10 pm]
Anchoring controls with d...
by
jamie
[
Today
at 11:22:45 am]
Recompiled IDE with LCLRe...
by
AlexTP
[
Today
at 05:09:56 am]
exception external SIGSEG...
by
billjtx
[
Today
at 01:06:50 am]
Commerce website written ...
by
Joanna
[
Today
at 01:00:28 am]
TaurusTLS 1.0.0.25 beta 2...
by
LeP
[December 12, 2025, 09:21:31 pm]
Single / Double / Float s...
by
tetrastes
[December 12, 2025, 09:10:39 pm]
Publish a LAMW app in F-d...
by
spacepascal
[December 12, 2025, 09:00:41 pm]
OS/2 Warp 4 problem with ...
by
PascalDragon
[December 12, 2025, 08:30:23 pm]
Introducing PasBuild 1.0....
by
PascalDragon
[December 12, 2025, 08:20:32 pm]
Convert string with Key-V...
by
Bart
[December 12, 2025, 07:28:04 pm]
The TChromeTabs component...
by
1-berto
[December 12, 2025, 07:02:28 pm]
Military Grade Directives
by
Warfley
[December 12, 2025, 05:44:12 pm]
How can I make a safe app...
by
marcov
[December 12, 2025, 02:58:10 pm]
« previous
next »
Print
Pages:
1
[
2
]
Author
Topic: accented char (Read 9176 times)
Paolo
Hero Member
Posts: 643
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