Unicode question

V

Vince

I seem to have a strange unicode problem. Let me descibe what I am doing:

Part of my VBA tool involves reading from a unicode saved text file which is
in the format:

findwordSPLITreplaceword

The VBA code then processes the sequence of lines and keeps replacing
"findword" with "replaceword". The sample text file is attached and its
contents are:

?SPLIT&agr;
?SPLIT&bgr;
?SPLIT&khgr;

Whenever I try to get the "findword" using a command like:

SPL=split(EachLine,"SPLIT")
msgbox strconv(SPL(0),vbfromunicode) ' Shows me gibberish for alpha and
gamma BUT works for beta!

The problems happen only for some unicode symbol fonts and work for all
other normal fonts and most symbol fonts.

My question is, if I need to have a file that may contain unicode characters
and is saved in unicode format and I need to be able to do find and replaces
the way mentioned above, what would be the best method? I have no idea why
this doesn't work for alpha and gamma and works for many others!

Thanks for your thoughts on this.

Vince
 
K

Klaus Linke

Hi Vince,

Have you simply opened the Unicode text file, and verified that there is a
Greek alpha at &agr; (Unicode U+03B1)?

You write about Unicode symbol fonts, but fonts like say "Symbol" aren't
Unicode fonts. There isn't any standard for what happens if an application
saves text with some old symbol font as Unicode text.
Word2004 translates characters from "Symbol" to the corresponding Unicode
characters, I think, while other versions of Word might just delete it,
insert "a", or some junk, maybe even different junk depending on how the
symbol was inserted (keyboard versus dialog).

I've written my own macro to save Word docs as Unicode text files that at
least saves the codes that Word uses internally (say U+F061 for the alpha,
since it's on the letter "a" = U+0061, and Word adds &HF000), but those
codes are the same for all symbol fonts, and without knowledge about the
font that was used, you can't tell the character.

Regards,
Klaus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top