]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/encconv.tex
replaced occurences of \_ by _ in verbatim environment
[wxWidgets.git] / docs / latex / wx / encconv.tex
1 %
2 % automatically generated by HelpGen from
3 % encconv.h at 30/Dec/99 18:45:16
4 %
5
6
7 \section{\class{wxEncodingConverter}}\label{wxencodingconverter}
8
9 This class is capable of converting strings between any two
10 8bit encodings/charsets. It can also convert from/to Unicode (but only
11 if you compiled wxWindows with wxUSE_UNICODE set to 1).
12
13
14 \wxheading{Derived from}
15
16 \helpref{wxObject}{wxobject}
17
18
19 \latexignore{\rtfignore{\wxheading{Members}}}
20
21
22 \membersection{wxEncodingConverter::wxEncodingConverter}\label{wxencodingconverterwxencodingconverter}
23
24 \func{}{wxEncodingConverter}{\void}
25
26 Constructor.
27
28 \membersection{wxEncodingConverter::Init}\label{wxencodingconverterinit}
29
30 \func{bool}{Init}{\param{wxFontEncoding }{input\_enc}, \param{wxFontEncoding }{output\_enc}, \param{int }{method = wxCONVERT\_STRICT}}
31
32 Initialize convertion. Both output or input encoding may
33 be wxFONTENCODING\_UNICODE, but only if wxUSE\_ENCODING is set to 1.
34 All subsequent calls to \helpref{Convert()}{wxencodingconverterconvert}
35 will interpret it's argument
36 as a string in {\it input\_enc} encoding and will output string in
37 {\it output\_enc} encoding.
38 You must call this method before calling Convert. You may call
39 it more than once in order to switch to another conversion.
40 {\it Method} affects behaviour of Convert() in case input character
41 cannot be converted because it does not exist in output encoding:
42
43 \begin{twocollist}
44 \twocolitem{{\bf wxCONVERT\_STRICT}}{follow behaviour of GNU Recode -
45 just copy unconvertable characters to output and don't change them
46 (its integer value will stay the same)}
47 \twocolitem{{\bf wxCONVERT\_SUBSTITUTE}}{try some (lossy) substitutions
48 - e.g. replace unconvertable latin capitals with acute by ordinary
49 capitals, replace en-dash or em-dash by '-' etc.}
50 \end{twocollist}
51
52 Both modes gurantee that output string will have same length
53 as input string.
54
55 \wxheading{Return value}
56
57 FALSE if given conversion is impossible, TRUE otherwise
58 (conversion may be impossible either if you try to convert
59 to Unicode with non-Unicode build of wxWindows or if input
60 or output encoding is not supported.)
61
62
63 \membersection{wxEncodingConverter::Convert}\label{wxencodingconverterconvert}
64
65 \func{wxString}{Convert}{\param{const wxString\& }{input}}
66
67 \func{void}{Convert}{\param{const wxChar* }{input}, \param{wxChar* }{output}}
68
69 \func{void}{Convert}{\param{wxChar* }{str}}
70
71 Convert input string according to settings passed to \helpref{Init}{wxencodingconverterinit}.
72 Note that you must call Init before using Convert!
73
74
75
76 \membersection{wxEncodingConverter::GetPlatformEquivalents}\label{wxencodingconvertergetplatformequivalents}
77
78 \func{wxFontEncodingArray}{GetPlatformEquivalents}{\param{wxFontEncoding }{enc}, \param{int }{platform = wxPLATFORM\_CURRENT}}
79
80 Return equivalents for given font that are used
81 under given platform. Supported platforms:
82
83 \begin{itemize}
84 \item wxPLATFORM\_UNIX
85 \item wxPLATFORM\_WINDOWS
86 \item wxPLATFORM\_OS2
87 \item wxPLATFORM\_MAC
88 \item wxPLATFORM\_CURRENT
89 \end{itemize}
90
91 wxPLATFORM\_CURRENT means the plaform this binary was compiled for.
92
93 Examples:
94 \begin{verbatim}
95 current platform enc returned value
96 ----------------------------------------------
97 unix CP1250 {ISO8859_2}
98 unix ISO8859_2 {ISO8859_2}
99 windows ISO8859_2 {CP1250}
100 unix CP1252 {ISO8859_1,ISO8859_15}
101 \end{verbatim}
102
103 Equivalence is defined in terms of convertibility:
104 2 encodings are equivalent if you can convert text between
105 then without loosing information (it may - and will - happen
106 that you loose special chars like quotation marks or em-dashes
107 but you shouldn't loose any diacritics and language-specific
108 characters when converting between equivalent encodings).
109
110 Remember that this function does {\bf NOT} check for presence of
111 fonts in system. It only tells you what are most suitable
112 encodings. (It usually returns only one encoding.)
113
114 \wxheading{Notes}
115
116 \begin{itemize}
117 \item Note that argument {\it enc} itself may be present in returned array!
118 (So that you can - as a side effect - detect whether the
119 encoding is native for this platform or not.)
120
121 \item helpref{Convert}{wxencodingconverterconvert} is not limited to
122 converting between equivalent encodings, it can convert between arbitrary
123 two encodings!
124 \end{itemize}
125
126
127 \membersection{wxEncodingConverter::GetAllEquivalents}\label{wxencodingconvertergetallequivalents}
128
129 \func{wxFontEncodingArray}{GetAllEquivalents}{\param{wxFontEncoding }{enc}}
130
131 Similar to
132 \helpref{GetPlatformEquivalents}{wxencodingconvertergetplatformequivalents},
133 but this one will return ALL
134 equivalent encodings, regardless the platform, and including itself.
135