I have some simple code:
procedure TForm1.Button1Click(Sender:TObject);
var
x: RawByteString;
begin
x := UTF8Encode('testing utf8');
if (IsUTF8String(x)) then
Memo1.Lines.Add('true');
end;
This returns False, am I doing something wrong?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are no special characters in that string that would require UTF-8 encoding — there are no multibyte UTF-8 sequences in the string. It looks like a plain ASCII string.
If there’s anything you can do to the design of your program that would eliminate the need to guess about the encodings of your strings, I recommend you do it. Guesses can be wrong. Try not to be wrong about your customers’ data.