Saturday, November 11, 2006

[Delphi] COM of libiconv

I have just finished my first serious bit of Delphi programming, using Turbo Delphi Explorer. As a RAD/IDE it's pretty good. However, given the limitations of the Explorer version, I'll upgrade to the Pro version fairly soon.

COMlibiconv is an in-process COM object and was born out of the company's need to convert some multibyte encodings into Unicode. It's based on DIConverters, a unit made available by Ralf Junker of
The Delphi Inspiration. DIConverters is licensed as LGPL. COMlibiconv will also be LGPL.

(Did I mention that I'm working again? No? Okay, well now I work as a software engineer for Strapper Technologies, of Fremantle, WA, Australia, makers of the Protium language.)

I'll be posting version 1.0 of the project up on Freshmeat by the end of next week, God willing.

COMlibiconv appears to work. I've used it in VBScript, late-bound, as
and I think my boss has used it, early-bound, in VB6.

At this stage the methods and properties exposed are as follows (taken from the source):
The function iconv_toUnicode takes a string defining the name of the multibyte encoding, the string to be converted, and two integers stating where to start and when to finish. I should probably give those default values so that the method can be called with just the encoding and the string.

ErrorCode contains an integer value which, when Success is false, represents what went wrong. An enumeration of possible error values is indicated and may make it into the next version.

Aliases gives all the various names for an encoding, indexed by a number from zero to the number of encodings (which can be found using Count).

CNames is also indexed in a similar way, and returns what I have called the 'CName' of the encoding. It's stuff that was in the DIConverters unit. I haven't found a use for it, but included it anyway.

The next version will, God willing, contain a method to allow conversions from Unicode back to multibyte.

If you're interested in this, and it hasn't appeared on Freshmeat by 18th November 2006, write a comment to remind me.

© Copyright Bruce M. Axtens, 2006

No comments: