realbasic-nug
[Top] [All Lists]

Re: RegEx search pattern empty?

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: RegEx search pattern empty?
From: Frank Bitterlich <bitterlich at gsco dot de>
Date: Fri, 04 Jul 2003 14:57:52 +0200
On 04.07.2003 12:11 Uhr, Peter J. Hartmann wrote:
....
> or, to make sure that everything is UTF8, even
> 
> c=GetTextConverter(GetTextEncoding(2), getTextEncoding(2))
> myRegex.SearchPattern=c.convert("some string")

Not sure what you're doing here, but that code is equvalent to

   myRegex.SearchPattern = C.DefineEncoding(encodings.UTF8)

But that does not *change* the encoding, it just *tells* RB that the
encoding of that string is UTF8 - whether that's true or not.

I don't know why the search pattern remains empty, but I think waht you want
to do is more like this...

   myRegEx.SerahcPattern = C.ConvertEncoding(encopdings.UTF8)

Note that this isn't necessary if C comes from, say, and EditField; in that
case it's already in UTF8, and RB knows about that.

Are you sure that C actually contains something? BTW, there is a bug in
TextConverter.Convert() that results in empty strings if the input is longer
than 1024 bytes (or characters? Don't remember exactly) or so.

You won't have that problem with ConvertEncoding().

Cheers,
   Frank+++


-- 

Günter Schmidt & Co. oHG
Frank Bitterlich             eMail: bitterlich at gsco dot de
Schlosserstr. 4              WWW:   http://www.gsco.de/gsco
D-60322 Frankfurt            Tel.:  069 / 156809-29
GERMANY                      Fax:   069 / 156809-28



---
A searchable archive of this list is available at:
<http://support.realsoftware.com/listarchives/search.php>

Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
.


<Prev in Thread] Current Thread [Next in Thread>