N
N
nalimite2018-09-14 06:38:37
Delphi
nalimite, 2018-09-14 06:38:37

How to load unicode in Delphi?

Good time!
The question arose about loading Unicode in Delphi. Is it possible to load it into tStringList?
5b9b2d316632c127989171.png<- Screenshot. There is a file of such content, the blue arrow marks the very symbol that prevents the file from being loaded into the program, the red arrow marks the line that it loads.
That is, the file is loaded into tStringList up to the "NUL" character.
Is it possible somehow to load this file completely into tStringList?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2018-09-14
@nalimite

This is not a Unicode character, it is a character with code 0. In many programming languages, this character marks the end of a line. As far as I remember, for Delphi this character is not a hindrance, but when you try to display the contents of TStringList in some control (Memo for example), then the cut will be just on this character.
See through the debugger what the contents of TStringList are after loading the file. If the whole file is there, then you just need to delete this symbol, if not, then you will need to upload the file via TFileStream, then again delete this NULL and then transfer it where necessary.

D
Dmitry, 2018-09-14
@demon416nds

preprocess the string, for example, to exclude non-unicode characters
ps you would show this line in a hex editor
it would immediately become clearer

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question