View Full Version : Macro for converting Unicode into ASCII?
Has anybody a Word-Macro to convert Greek Unicode into normal ASCII or the Bibleworks format?
I know I can create it myself, but if someone already has it? I think this would be of general benefit.
jdarlack
10-14-2004, 05:10 PM
Hi Wieland,
Ricardo Román shared two macros with me back in the Topica days... One is to convert Unicode to BWGRKL and the other to convert Unicode into CCAT format.
I am attaching a text file with the macros within it.
Enjoy!
Michael Hanel
10-15-2004, 12:09 AM
Wow, that's helpful, thanks!!
Mike
Wow, that's helpful, thanks!!
I can only repeat that: WOW! Exactly what I needed.
Thank you very much!
jdarlack
10-15-2004, 09:14 AM
Wow, that's helpful, thanks!I can only repeat that: WOW!
Big thanks to Ricardo "Gandalf (http://www.bibleworks.com/forums/member.php?u=108)" Román! He's the one who put this macro together, and it has been quite "configurable" for various other font conversions. It was the basis for the "drogulin" macro posted on my personal website (linked in my signature below).
Roy Ciampa
10-15-2004, 10:02 AM
That is great! Don't suppose anyone has a macro to go from Bwgrkl to unicode?
jdarlack
10-15-2004, 11:51 AM
...a macro to go from Bwgrkl to unicode...I just reversed one of the macros that I posted earlier and did some quick "tweaking." It has worked so far. See attachment.
WARNING! This macro changes ALL TEXT in a document into Palatino Linotype in the Greek font ranges! So, this means you would have to "cut and paste" from BibleWorks into an "conversion document," run the macro, and then copy from that into your text.
There's gotta be an easier way! ;)
And there IS an easier way!
I was just reminded of a macro that John Kendall developed that finds the bwgrkl text and changes it, while leaving the rest of your text free of any change!
Follow this link:
http://www.bibleworks.com/forums/attachment.php?attachmentid=54
See my later post:
http://www.bibleworks.com/forums/showpost.php?p=2171&postcount=11
Michael Hanel
10-15-2004, 12:00 PM
I'm also trying to tweak the Unicode-->BWGrkL, I noticed that some of the characters don't copy over well on the small chunks of text i've tested, the problem mainly being with accents and breathing marks. Nevertheless, it certainly is quicker than the alternate route of trying to do this all by hand from scratch ;)
Mike
Michael Hanel
10-15-2004, 12:14 PM
Ok, I added these lines to the CCAT-->BWGrkL
WordBasic.EditReplace Find:=":", Replace:="Ç", Direction:=0, MatchCase:=1, WholeWord:=0, PatternMatch:=0, ReplaceAll:=1, Format:=0, Wrap:=0
WordBasic.EditReplace Find:="'", Replace:="V", Direction:=0, MatchCase:=1, WholeWord:=0, PatternMatch:=0, ReplaceAll:=1, Format:=0, Wrap:=0
WordBasic.EditReplace Find:="[", Replace:="Î", Direction:=0, MatchCase:=1, WholeWord:=0, PatternMatch:=0, ReplaceAll:=1, Format:=0, Wrap:=0
WordBasic.EditReplace Find:="]", Replace:="Ð", Direction:=0, MatchCase:=1, WholeWord:=0, PatternMatch:=0, ReplaceAll:=1, Format:=0, Wrap:=0
in order to make colons, "apostrophes" (where vowels elided), and left and right square brackets convert into the proper codes in BwGrk. I think the only glitch left that I see is how to change a smooth breathing mark and a grave accent on the same vowel. Anybody know what line would be needed for that?
My test text was Agamemnon (http://perseus.uchicago.edu/cgi-bin/ptext?doc=Perseus%3Atext%3A1999.01.0003) since I knew that could be displayed in Unicode.
Mike
jdarlack
10-15-2004, 12:34 PM
Have you tried the macro I just posted?
The tweaking that I did involved piling all the combined accented / breathing-marked / iota subscripted characters first, so that the combined characters that require three "letters" in bwgrkl (e.g., w-| = w-l) are converted first, then two character codes (e.g., h| = h|) then one character codes...
This way you cover all your complex characters first and go to the next lower level of complexity, etc. I think I caught most of the complex characters, and a few of the punctuation marks like brackets and commas had to be "tweaked" as well. This is fascinating stuff...
There is a "relief on the way"...according to "official reports," the next release will have the ability to export Greek & Hebrew in Unicode. Here's a note from Mike Bushell in a previous post (http://www.bibleworks.com/forums/showpost.php?p=1197&postcount=1):
Hi BTers,
...snip... I want you to know that relief is in sight. We have completely replaced the editor now with a new editor that has all the capabilities of Wordpad and a lot more. It has full support for Unicode, multilevel undo, left-wrapped Hebrew and a wealth of formatting features. We also have BibleWorks now exporting Unicode Hebrew and Greek. These are major changes and we will need to do a lot of testing to get the kinks out but we will get it to you as soon as we can. I can't give you a date yet but I wanted you to know that some good things are coming.
God bless,
Mike Bushell for the
BibleWorks Programming Staff
jdarlack
10-15-2004, 04:14 PM
I was just reminded that someone sent me a MSWord macro written by John Kendall for converting BWGRKL text into Unicode Palatino Linotype.
Well now John has just posted an even better macro than the one he sent me months ago! (See the next post! (http://www.bibleworks.com/forums/showpost.php?p=2174&postcount=12)) This macro is much better than the one I posted earlier as it "picks out" what text in any document is Bwgrkl.ttf and converts it, leaving the rest of your document change free! It also catches errors and marks them with "marching red ants!"
Thanks Mark! :D
Thanks John! :D
I have removed the old version. Go to the next post to download the new version! (http://www.bibleworks.com/forums/showpost.php?p=2174&postcount=12)
J Kendall
10-16-2004, 08:44 AM
Hi Jim,
Since I sent you this, I've been wondering whether you were ever going to post it! I assumed that you had something more sophisticated in mind. ;) I've attached a slightly updated version.
I've no real knowledge of anything but the most elementary of macros and the simple series of search & replace procedures in this macro looks a bit clunky to me. I'm sure that there ought to be a more elegant way of doing it. It includes some odd instructions to cover common mistakes among students in their use of the bwgrkl font.
The macro is very fully commented so that it should be easy to identify anything that folk need to modify, though this does make it rather large. For instance, it's easy to do a search and replace on the macro to make it use the Unicode font of your choice.
It also contains a trap for any bwgrkl characters that are not converted to Unicode (the errant characters are marked with 'marching red ants', but it's easy to modify this to your own taste).
Please let me know if you find any errors or if you come up with some improvements.
God bless,
John
--
John Kendall
Cardiff
Wales
J Kendall
10-16-2004, 10:40 AM
If it's any use to anyone, there's also this macro that I cobbled together for converting Unicode Greek to Bwgrkl. It doesn't cover all the characters in the BW font (e.g. numerals, text critical signs etc) and was written in a hurry using the previous macro as its basis. However, it seems to do what I need for manipulating Word documents with biblical Greek texts.
I haven't tested it extensively, so again please let me know if you find any errors or if you come up with some improvements.
Oops! I'm not sure I should have submitted this. I originally wrote this macro as a quick and dirty fix for converting some documents with a mixture of English and Unicode Greek text with precomposed accents & diacritics. To avoid messing up the English text, I didn't convert the punctuation characters. Also, the apostrophe ( ' ) is used as elision mark in some Unicode Greek texts (e.g. those on Perseus), whereas the bwgrkl font uses V both as an elision mark and as a smooth breathing before initial uppercase vowels. The macro does not convert characters such as this to bwgrkl.
The non-functional subroutine "DontUse" at the end of the macro flags up the issue for further consideration & modification. If you simply want to convert a file consisting only of Unicode Greek or selected Unicode Greek text, you should be able to edit it appropriately. I just don't have time to play around with it right now.
The version I posted earlier doesn't convert a lone diaeresis. I've fixed this. There may be other issues.
John
--
John Kendall
Cardiff
Wales
Roy Ciampa
10-16-2004, 11:42 AM
The Bwgrkl to Unicode macro worked superbly! As mentioned by other posts the Unicode to Bwgrkl macro has some issues with accents and breathing marks, but those are minor issues, and I'm sure someone will post a newer and improved version before too long!
Michael Hanel
10-16-2004, 12:13 PM
This seems to be a Word XP problem I'm having, I don't know if there's something I can do to undo it, but I'm having trouble getting the smooth breathing mark and grave accent to show up in Word. For instance, if I set the font to BWGrkL and just start typing greek if I try to type the string "w'n" it will appear like this: w'n and not like the "w'n" it's supposed to.... anybody know what would cause that?? Otherwise the macro works very nicely.
Mike
jdarlack
10-18-2004, 08:53 AM
This seems to be a Word XP problem I'm having, I don't know if there's something I can do to undo it, but I'm having trouble getting the smooth breathing mark and grave accent to show up in Word. For instance, if I set the font to BWGrkL and just start typing greek if I try to type the string "w'n" it will appear like this: w'n and not like the "w'n" it's supposed to.... anybody know what would cause that?? Otherwise the macro works very nicely.
Mike
Hi Mike,
It looks like the problem is that you have Word set to convert quotes and apostrophes to smart quotes and apostrophes. To change it go to TOOLS | Auto Correct | AutoFormat as you type and uncheck the "Straight quotes with Smart quotes" box, do the same thing for the AutoFormat tab.
That should take care of it. This is why we want UNICODE!
Michael Hanel
10-18-2004, 11:39 AM
And problem solved. Now if only I knew why they called them smart quotes :rolleyes:
Mike
Roy Ciampa
10-19-2004, 11:01 AM
Thanks Jim,
That was the root of my problem, and I should have figured it out.
Roy
jdarlack
10-19-2004, 11:24 AM
I first ran into the smart quotes problem with Hebrew! Whenever I'd go to type a pathach, I'd get some form of gibberish that I didn't intend. You have to keep this in mind when you have "auto capitalization" on as well. For instance, a lowecase "a" is an aleph, but an uppercase "a" is a holem-vav.
One day, when Unicode is the completely accepted standard by everyone on all computers...as if it will ever happen...this won't be an issue...as much...
I'm sure that there will be some form of "auto-correct" that will stand in our way then as well!:rolleyes:
~Jim
pgons
04-25-2005, 04:26 PM
Thanks for the great macros. I've been wanting to figure out a way to convert bwgrkl to unicode. The conversion from bwgrkl to unicode seems to work very well! Two things I've noticed with the conversion from unicode to bwgrkl: (1) A word with a smooth breathing mark and a grave on the same letter results in a smooth breathing mark (or an apostrophe [?]) with no accent after the letter. Has anyone else noticed this? (2) Spaces in between letters do not get converted to bwgrkl. This is not that big of a deal, but it's just something I noticed. Thanks again for the great macros!
Phil Gons
jdarlack
04-25-2005, 05:01 PM
(1) A word with a smooth breathing mark and a grave on the same letter results in a smooth breathing mark (or an apostrophe) with no accent after the letter. Has anyone else noticed this?Hi Phil,
It looks like the problem here is with your auto-format as you type settings in Word. For the accents to work properly in BWGRKL, one must turn off the "Turn Quotes into Smart Quotes" settings off. Otherwise, it will change a simple apostrophe into a right-apostrophe and a simple quotation mark into a right-quotation mark. Hence, it looks like a smooth breathing mark (a right-apostrophe) following the letter, rather than the correct accent.
(2) Spaces in between letters do not get converted to bwgrkl. This is not that big of a deal, but it's just something I noticed.Regarding this issue, you could simply do a find-replace for any white space in between BWGRKL letters (after you ran the first macro), and then replace it with "find text" (usually ^&) in the BWGRKL font.
J Kendall
04-25-2005, 06:30 PM
Thanks for the great macros. I've been wanting to figure out a way to convert bwgrkl to unicode. The converion from bwgrkl to unicode seems to work very well! Two things I've noticed with the conversion from unicode to bwgrkl: (1) A word with a smooth breathing mark and a grave on the same letter results in a smooth breathing mark (or an apostrophe) with no accent after the letter. Has anyone else noticed this? (2) Spaces in between letters do not get converted to bwgrkl. This is not that big of a deal, but it's just something I noticed. Thanks again for the great macros!
Glad they've been of help Phil. I'd be the first to confess the limitations of the unicode to bwgrkl macro - see the disclaimers in my earlier post. However, I think Jim's post should solve problem (1). Problem (2) is intentional. As the warnings in my earlier post explain, this macro was a quick fix for some files with mixed English and Greek text. I didn't want all the white spaces in the English text converted to bwgrkl.
Despite its limitations, the macro is very fully commented and should provide enough information for you to adapt it according to your needs.
John
--
John Kendall
Cardiff
Wales
pgons
04-25-2005, 07:09 PM
Jim and John,
Thanks for the clarification. That answers both questions. Thank you both very much.
Phil Gons
John Parsons
07-13-2005, 04:47 AM
Does anyone have such a macro, or know where I might learn how to create one?
Thank you,
Joshua Luna
08-24-2005, 01:10 AM
Does anyone have such a macro, or know where I might learn how to create one?
Thank you,
http://www.bibleworks.com/forums/showthread.php?t=604
I was looking for the same utility... this may or may not work, but I found this link while searching the forum.
MickZ
02-21-2006, 12:08 PM
Hello John Kendall,
Am I allowed to use parts of your macros in another word-macro i want to share with my fellow students at my seminary?
I`m creating a combined macro for converting fonts from BW and E-sword to UniCode an vice versa.
Michael
J Kendall
02-22-2006, 06:02 AM
Hello John Kendall,
Am I allowed to use parts of your macros in another word-macro i want to share with my fellow students at my seminary?
I`m creating a combined macro for converting fonts from BW and E-sword to UniCode an vice versa.
Hi Michael,
I posted it for anyone to use as they wish. I'm just glad that my initial clunky efforts at playing with macros are of use to someone!
It may be that your macro will be useful for other Bibleworks users. Perhaps when it's complete you might be willing to post it here.
God bless,
John
MickZ
02-26-2006, 09:47 AM
Thanks a lot, John !!! :)
I`m working on it!
God bless you!
Michael
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.