# Barry::IConverter Class Reference

`#include <iconv.h>`

Collaboration diagram for Barry::IConverter:

[legend]

List of all members.

## Detailed Description

Main charset conversion class, primarily focused on converting between the Blackberry charset and an application-specified one.

Additional conversions are possible through custom IConvHandle, but the goal of this class design is to deal with _one_ application defined charset, and provide a means to convert to/from that charset to/from any other charset needed by the Blackberry.

By default, this class assumes the Blackberry's charset is WINDOWS-1252, but some data, such as SMS message bodies, can have custom charsets as specified by the records. To convert from such a custom charset, use:

application sets up IConverter IConverter ic("UTF-8");

somewhere in the library, needing to convert from UCS2 to whatever the application selected IConvHandle ucs2("UCS2", ic); application_string = ic.Convert(ucs2, ucs2_string_data);

and to convert back... IConvHandle ucs2_reverse(ic, "UCS2"); ucs2_string = ic.Convert(ucs2_reverse, application_string_data);

Definition at line 86 of file iconv.h.

## Public Member Functions

| IConverter (const char *tocode="UTF-8", bool throw_on_conv_err=false)
| Always throws ErrnoError if unable to open iconv.

## Constructor & Destructor Documentation

Barry::IConverter::IConverter | ( | const char * | tocode = `"UTF-8"`,
|  | bool | throw_on_conv_err = `false` |
| ) |  |  | `[explicit]`

Always throws ErrnoError if unable to open iconv.

If throw_on_conv_err is true, then string conversion operations that fail will also throw ErrnoError.

Definition at line 69 of file iconv.cc.

The documentation for this class was generated from the following files:

- iconv.h
- iconv.cc