[haiku-development] Re: BString and UTF-8

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Fri, 02 Dec 2011 17:08:00 +0100

On 02.12.2011 12:58, Michael Bridgers wrote:
Some of the things that I need the Jamfiles to do:
- Add additional include directories to the BString compile
- Add additional dependent libraries to the libbe.so link step

Maybe you should have written to mails; you only seem to get replies to what you intend to do :-)

Normally you would use the UseHeader rule to include other headers, and add the libraries to the libbe.so build rule (the colon after the source files specifies the link files). Since ICU is only available as an external file, it might work a little differently. liblocale.so needs both these things, too, though, so looking at its Jamfile should help you there.

I am looking at several possible approaches to providing the
functionality in the BString class:
- Have the BString class use ICU directly

I would think that using it directly from libbe.so is fine.

The changes to the BString class fall into several categories:
- Making sure the BString class always holds valid UTF-8 strings
(Allowing invalid UTF-8 strings is both a security risk, as well as
making operations on existing strings difficult or impossible.)

This all sounds like very welcomed changes, but this one cannot be done in a backward compatible manner, unfortunately. As long as all *Chars() methods deal with invalid UTF-8 correctly (as they should), there is no security risk either. I would just add a method IsValidUTF8() or something to that degree which you can use to test it.


Other related posts: