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