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