Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

TQHebrewCodec Class Reference

The TQHebrewCodec class provides conversion to and from visually ordered Hebrew. More...

All the functions in this class are reentrant when TQt is built with thread support.

#include <ntqrtlcodec.h>

Inherits TQTextCodec.

List of all member functions.

Public Members


Detailed Description

The TQHebrewCodec class provides conversion to and from visually ordered Hebrew.

Hebrew as a semitic language is written from right to left. Because older computer systems couldn't handle reordering a string so that the first letter appears on the right, many older documents were encoded in visual order, so that the first letter of a line is the rightmost one in the string.

In contrast to this, Unicode defines characters to be in logical order (the order you would read the string). This codec tries to convert visually ordered Hebrew (8859-8) to Unicode. This might not always work perfectly, because reversing the bidi (bi-directional) algorithm that transforms from logical to visual order is non-trivial.

Transformation from Unicode to visual Hebrew (8859-8) is done using the bidi algorithm in TQt, and will produce correct results, so long as the codec is given the text a whole paragraph at a time. Places where newlines are supposed to go can be indicated by a newline character ('\n'). Note that these newline characters change the reordering behaviour of the algorithm, since the bidi reordering only takes place within one line of text, whereas line breaks are determined in visual order.

Visually ordered Hebrew is still used quite often in some places, mainly in email communication (since most email programs still don't understand logically ordered Hebrew) and on web pages. The use on web pages is rapidly decreasing, due to the availability of browsers that correctly support logically ordered Hebrew.

This codec has the name "iso8859-8". If you don't want any bidi reordering to happen during conversion, use the "iso8859-8-i" codec, which assumes logical order for the 8-bit string.

See also Internationalization with TQt.


Member Function Documentation

TQCString TQHebrewCodec::fromUnicode ( const TQString & uc, int & lenInOut ) const [virtual]

Transforms the logically ordered TQString, uc, into a visually ordered string in the 8859-8 encoding. TQt's bidi algorithm is used to perform this task. Note that newline characters affect the reordering, since reordering is done on a line by line basis.

The algorithm is designed to work on whole paragraphs of text, so processing a line at a time may produce incorrect results. This approach is taken because the reordering of the contents of a particular line in a paragraph may depend on the previous line in the same paragraph.

Some encodings (for example Japanese or UTF-8) are multibyte (so one input character is mapped to two output characters). The lenInOut argument specifies the number of TQChars that should be converted and is set to the number of characters returned.

Reimplemented from TQTextCodec.

const char * TQHebrewCodec::mimeName () const [virtual]

Returns the codec's mime name.

Reimplemented from TQTextCodec.


This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.


Copyright © 2007 TrolltechTrademarks
TQt 3.3.8