Xojo Conferences

Office Automation/String Encoding Woes (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Re: Editfields: Automatically enable copy/paste/cut
Next thread: idle Applescript

Editfields: Automatically enable copy/paste/cut   -   Jan Erik Moström <
  Office Automation/String Encoding Woes   -   Paul Mitchum

Office Automation/String Encoding Woes
Date: 09.08.02 19:36 (Fri, 09 Aug 2002 13:36:40 -0500)
From: Paul Mitchum
Trying to figure out a round-trip problem here...

This code gets the selection from Word:

if WordIsRunning then
werd = new WordApplication
if werd <> nil then
sel = werd.Selection
if sel <> nil then // no document means nil selection
if sel.type <> 1 then // not insertion point
s = sel.Text
end if
end if
end if
end if

However, if the text contains a curly-quote, as in:

I am joe¹s fight club

then s will contain this:

I am joe,Äôs fight clu (that is, strange characters for the curly-quote,
and the last character cut off)

...and if I put that in an EditField and then cut and paste it to this very
document, I end up with:

I am joe¹s fight club (that is, exactly what was selected in Word)

...so obviously there's some encoding information I'm not seeing. Where is
it? VBA/Office Automation doesn't give me any help, other than to know it's
theoretically in English. I can also see how this might be something vaguely
buggy in RB's string handling, but it's hard to be sure without any office
automation documentation. Hint Hint. :-)

RB 4.0.2/Mac OS X 10.1.5/Office v.X

Any help appreciated. Please CC: since I'm reading the digest.