From kde-core-devel Thu Jul 11 19:34:49 2002 From: Marc Mutz Date: Thu, 11 Jul 2002 19:34:49 +0000 To: kde-core-devel Subject: Re: PATCH: kdelibs/kdecore/kstringhandler.cpp tagURLs() method X-MARC-Message: https://marc.info/?l=kde-core-devel&m=102642138919724 =2D----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday 11 July 2002 13:11, Stephan Hermann wrote: > Well, I changed the regexp in this way: (cleaned up C-string quoting) (?:www\.|ftp\.|\w+\://)[\d\w\.]+[:\d]{0,}[/]{0,1}[~/\.-?&=3D#:_\d\w]{0,} ^1 ^2 ^3 ^4 1: wouldn't this be "*" 2: a class with a single char? 3: wouldn't this be "?" 4: see (1) > And at least, the replacement in hrefProtocol I changed, too. > Not in this way, you described in your last mail, but I used sprintf > and QString::latin1() How exactly? Since QString::sprintf() assumes %s parameters to be in=20 UTF-8, not latin1. > > No, the safe way is to use operator+: > > QString url =3D "" + href + ""; > > Hmmm...I like the sprintf way ;) but well, i can change it into your > solution if you want and disagree with the sprintf way. Well, I'm not the maintainer of that code, but if you want my advice,=20 then you should use operator+, since it's 1. faster (doesn't involve unneccessary QString<->char*<->QString=20 conversions) 2. possibly still more robust. > I'll make a patch and send it to you directly Why to me? I'm not the maintainer, don't run HEAD, and if you listen to=20 Harri and write a test program (e.g. using the examples from the=20 URL/URI/URN RFCs), then you should be able to convince yourself of the=20 correctness ;-) IOW: post it here. Marc =2D --=20 Marc Mutz =2D----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9Ld3h3oWD+L2/6DgRAmN4AJ9MQVOW6I2osNUCqrVAwaf7ON0SzQCfRaSo fbJC3HE084LN7knSvmDsKRY=3D =3DIwJL =2D----END PGP SIGNATURE-----