Mailinglist Archive: yast-devel (23 mails)

< Previous Next >
Re: [yast-devel] Re: YCP substring() Was: YCP String operator [] and UTF-8
* Ladislav Slezak <lslezak@xxxxxxx> [Apr 03. 2012 11:10]:

Ooops, I just realized that the problem is actually in substring() function,
[] operator works only with lists, maps or terms in YCP. (I'm using so many


I used substring() to get one character. So the problematic call is actually:

substring("áa", 1, 1);

which returns "\0xF1" instead of "a" as I expected.

The documentation does not tell whether the substring() argument units are in
bytes or characters.

So any opinions on changing this call? Is the UTF-8 assumption also valid

Yes. sub_string_ is operating on strings and strings are defined to be
UTF-8 encoded.


SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB
16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >
List Navigation