Re: Tech: Unicode (was...)
From: | Philippe Caquant <herodote92@...> |
Date: | Monday, May 3, 2004, 20:22 |
Great. So I managed to make some little Word macro at
last. Probably awfully badly written, but this is my
first trial for such a thing !
If you paste in a Word document an entry like:
410,411,412,413,414,415,416,417,420,20,661,662,663,664,665,666,667,668,669
(supposed to be in hexadecimal, except the commas)
then select it and launch the macro, you should get
the 9 first capital cyrillic letters, followed by a
blank and by the 9 Arabic numbers from 1 to 9.
As I said, to me it is much clearer and safer to have
the real hexcodes as an input than anything else,
except decimal codes of course.
Here's the macro (please don't laugh !):
Sub MyMacro()
'
' Converts a list (hexcode,hexcode,...,hexcode) to
Unicode characters
'
Dim strTemp As String
Dim Lg As Integer
Dim I As Integer
Dim Car As String
Dim Sch As String
Dim Separ As String
Dim HexPfx As String
Dim CUnicode As Long
Separ = "," ' separator between hex codes
HexPfx = "&H" ' prefix for an hex code
strTemp = Selection.Text
Selection.Cut
Lg = Len(strTemp)
Sch = HexPfx
For I = 1 To Lg
Car = Mid(strTemp, I, 1)
If Car = Separ Then
CUnicode = CLng(Sch)
Selection.InsertSymbol
CharacterNumber:=CUnicode, Unicode:=True, Bias:=0
Sch = HexPfx
Else
Sch = Sch & Car
End If
Next I
If Sch > HexPfx Then
CUnicode = CLng(Sch)
Selection.InsertSymbol
CharacterNumber:=CUnicode, Unicode:=True, Bias:=0
End If
End Sub
--- "Mark J. Reed" <markjreed@...> wrote:
> > If there is a rule saying that in Unicode, Hex-413
> is
> > Cyrillic 4th letter of the alphabet in capitals
> (Ge),
> > so just tell me it's Hex-413 and I'll be able to
> read
> > it, and redraw it (although it would be better if
> a
> > macro could do it for me). If there is no such
> rule,
> > then I can't see any interest for Unicode at all.
>
> Of course there is such a rule. That is what
> Unicode is, primarily: a
> mapping from numbers to characters. The number
> 1,043, which is 413 in
> hexadecimal, is associated with CYRILLIC CAPITAL
> LETTER GHE.
>
> -Mark
=====
Philippe Caquant
"High thoughts must have high language." (Aristophanes, Frogs)
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover
Reply