Commit Graph

6 Commits

Author SHA1 Message Date
Adrien Destugues c4da848565 BTextEncoding: even more style fixes. 2016-09-27 20:41:26 +02:00
Adrien Destugues a71b10d760 BTextEncoding: fix naming and move to BPrivate namespace. 2016-09-27 20:38:58 +02:00
Adrien Destugues 32afcc5cc5 Style fix in Locale Kit headers.
As pointed out by Axel, the wrong style was used in these headers we
inherited from OpenTracker days.
2016-09-27 19:34:52 +02:00
Adrien Destugues a95053ddb7 TextEncoding: Style fixes to header.
As pointed out by Axel.
2016-09-27 07:20:47 +02:00
Adrien Destugues 08e5249142 TextEncoding: add Encode/Decode methods.
This replaces convert_from/to_utf8 in a way that doesn't leak memory.

Use the new method in StyledEdit.

Fixes #6252, #3065.
2016-09-25 23:16:19 +02:00
Adrien Destugues fbb725bbdc Add text encoding detection to the Locale Kit.
As usual we ask ICU to do the actual work. The TextEncoding constructor
is fed with a sample of the text to identify (ICU docs recommend a few
hundred bytes). The text is analyzed in various ways (bytes patterns
such as UTF-8 escaping schemes, common letter sequences from known
languages, byte order marks) and an encoding is determined.

Replace code in StyledEdit by this new implementation.

Note that ICU seems to always return some valid encoding, even with fed
with obviously non-text data. This makes StyledEdit open the files no
matter what, where it would error out before.

Fixes #9395.
2016-09-25 18:50:29 +02:00