[Overview][Types][Classes][Procedures and functions][Variables][Index] |
Replaces all invalid UTF-8 characters with spaces.
Source position: lazutf8.pas line 106
procedure UTF8FixBroken( |
P: PChar |
); overload; |
var S: string |
); overload; |
P |
|
PChar with the UTF-8-encoded values examined in the routine. |
S |
|
String with the UTF-8-encoded values examined in the routine. |
UTF8FixBroken is an overloaded routine used to replace all invalid UTF-8 characters with spaces. The overloaded variants allow the UTF-8-encoded content to be specified using either a PChar or a String type.
The PChar variant examines the specified byte values to determine when an invalid UTF-8 codepoint is found. This includes byte values that fall outside of the ranges allowed in UTF-8, and common byte sequences used to inject XSS vulnerabilities.
UTF-8 byte sequences updated in the routine are stored in the original PChar argument.
UTF8FixBroken processing at the first occurrence of the byte value #0 (Decimal 0).
The String variant converts the argument to a PChar type and calls FindInvalidUTF8Codepoint to locate invalid UTF-8 byte sequences. When found, UniqueString is called to get a new reference-counted String for the return value.
|
Finds the position where an invalid UTF-8 codepoint is found in the string. |
|
Version 3.2 | Generated 2024-02-25 | Home |