Mailinglist Archive: yast-devel (23 mails)

< Previous Next >
[yast-devel] Re: YCP substring() Was: YCP String operator [] and UTF-8
Dne 3.4.2012 10:15, Klaus Kaempf napsal(a):
* Ladislav Slezak<lslezak@xxxxxxx> [Apr 03. 2012 10:08]:

I'm not sure what the correct solution is. Maybe the correct way is to fix the
[] operator after all...

In YCP, all strings are supposed to be UTF-8 encoded. This is how YaST was
designed from the beginning. From that perspective, fixing the [] operator for
strings is the right solution.

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
languages...).

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.
http://doc.opensuse.org/projects/YaST/openSUSE11.3/tdg/substring-rest.html

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

Thanks!

--

Best Regards

Ladislav Slezák
Yast Developer
------------------------------------------------------------------------
SUSE LINUX, s.r.o. e-mail: lslezak@xxxxxxx
Lihovarská 1060/12 tel: +420 284 028 960
190 00 Prague 9 fax: +420 284 028 951
Czech Republic http://www.suse.cz/
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >
List Navigation