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