realbasic-nug
[Top] [All Lists]

Re: Localization, encodings and blank menu items

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Localization, encodings and blank menu items
From: Erich dot Rast at t-online dot de (Erich Rast)
Date: Thu, 20 Mar 2003 15:53:16 +0100

I just found that ReplaceAll, in RB 4.5.3, does mess up UTF-8
strings when they contain chars > 127. Perhaps that's still buggy
in RB 5 and causing the trouble.


Looks like you're right. How can I work around it? I've even tried this in 5.0:

  // replace an occurrance of r in s, UTF8 encoding savvy
  Dim s1, r1,s2 as String
  Dim i,k as Integer
  s1 = DefineEncoding(src, encodings.UTF8)
  s2 = DefineEncoding(s, encodings.UTF8)
  r1 = DefineEncoding(r1,encodings.UTF8)
  k = len(s2)
  i = instr(s1, s2)
  return DefineEncoding(left(s1, i-1)+r+mid(s1, i+k)  , encodings.UTF8)

but it gives the same result: blank string in menus and msgbox! Then I changed all DefineEncoding above to ConvertEncoding(s, encodings.UTF8) with no change either. The same routine works for any string that doesn't contain special chars like the German Umlaut "ö", but returns 'nothing' when the replacement contains special characters.

Perhaps I'm just doing something blatantly wrong?

How do you replace an occurance of one string inside another by a third one, all strings in UTF8 encoding? Does anyone happen to know?

Best regards,

Erich


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

Unsubscribe:
<mailto:realbasic-nug-off at lists dot realsoftware dot com>

Subscribe to the digest:
<mailto:realbasic-nug-digest at lists dot realsoftware dot com>
.


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