HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_CharSetUtils.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_CharSetUtils.h (UT Library, C++)
7  *
8  * COMMENTS:
9  * Utilities for encoding, decoding, and converting text
10  * from, to, and between character sets and other encodings.
11  */
12 
13 #ifndef __UT_CharSetUtils__
14 #define __UT_CharSetUtils__
15 
16 #include "UT_API.h"
17 
18 class UT_String;
19 class UT_WorkBuffer;
20 
21 
23 {
24 public:
25  // The encoding of the source code strings (ie, the char* stuff)
26  // Currently it specifies ISO-9959-1 (Latin 1) char set.
27  static const char * const SRC_CODE_ENCODING;
28 
29  // The encoding used in the XML file. Currently it specifies UTF-8.
30  static const char * const XML_ENCODING;
31 
32  /// Conversion method from the source encoding to UTF-8 Unicode encoding.
33  /// src_str - the input string bytestream in the src_encoding
34  /// out_str - the output string bytesream in the UTF-8 encoding.
35  /// src_encoding - always Latin 1
36  //
37  /// Returns true if ok, false otherwise.
38  static bool encodeUTF8( const char * src_str,
39  UT_WorkBuffer & out_str );
40 
41  /// Conversion method from the source encoding of UTF-8 to the encoding
42  /// specified by the out_encoding.
43  /// src_str - the input string bytestream in the UTF-8 encoding.
44  /// out_str - the output string bytesream in the out_encoding.
45  /// out_encoding - always Latin 1
46  //
47  /// Returns true if ok, false otherwise.
48  static bool decodeUTF8( const char * src_str,
49  UT_WorkBuffer & out_str );
50  static bool decodeUTF8( const char * src_str,
51  UT_String & out_str );
52 
53 };
54 
55 #endif
56 
static const char *const SRC_CODE_ENCODING
#define UT_API
Definition: UT_API.h:12
static const char *const XML_ENCODING