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