Mailinglist Archive: yast-devel (23 mails)

< Previous Next >
Re: [yast-devel] YCP String operator [] and UTF-8
  • From: Ladislav Slezak <lslezak@xxxxxxx>
  • Date: Tue, 03 Apr 2012 10:06:18 +0200
  • Message-id: <4F7AAF7A.40807@suse.cz>
Dne 3.4.2012 09:37, Johannes Meixner napsal(a):

Could a YCP expert show the correct way (example code)
how to remove an UTF8 sub-string from an UTF8 string?
I.e. how to remove "Bar" from "FooBarBaz" in an UTF8-safe way?

More generally:
Is there documentation how to work on UTF8 strings with YCP in general?

Um, it seems that the documentation does not mention the [] behavior for string
(http://doc.opensuse.org/projects/YaST/openSUSE11.3/tdg/bracket.html nor http://doc.opensuse.org/projects/YaST/openSUSE11.3/tdg/id_ycp_data_string.html).

I fixed that particular bug by using regexpsub() instead of iterating over the
string
and using [] operator. So I guess the regexp*() functions are UTF-8 safe.

I'm not sure what the correct solution is. Maybe the correct way is to fix the
[]
operator after all... That's why I have opened this discussion, because maybe someone is relaying on the current "buggy" behavior... (I don't expect that
but I'd like to avoid regressions if possible.)


--

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
References