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