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: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Thu, 20 Mar 2003 08:39:55 -0800
At 4:23 PM +0100 3/20/03, Erich Rast wrote:

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)

I think you should lay off the DefineEncoding's -- these are very
rarely needed (mainly if you get a string from a file, socket, serial
port, or MessageBox).

The surest way the above would fail is if your strings are NOT, in
fact, UTF-8.  If you're telling RB they're UTF-8 but they're really
something else, then you've built an invalid string which can't be
converted properly for display.

Please post where these strings are coming from.

To see that it really does work, just put this into a StaticText Open event:

  me.text = ReplaceAll("?oo.?¼", "?", "å")

Run, and you'll see "åoo.å¼" as you should.

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?

Yes, you use ReplaceAll.  Something's wrong with the strings you're
working with (or else perhaps you're not really using RB5).

Best,
- Joe

--
,------------------------------------------------------------------.
|    Joseph J. Strout           REAL Software, Inc.                |
|    joe at realsoftware dot com       http://www.realsoftware.com        |
`------------------------------------------------------------------'

---
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>