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

# QHebrewCodec Class Reference

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

`#include <qrtlcodec.h>`

Inherits QTextCodec.

List of all member functions.

## Public Members

- virtual const char * mimeName () const
- virtual QCString fromUnicode ( const QString & uc, int & len_in_out ) const

## Detailed Description

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

Hebrew as a semitic language is written from right to left. As 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.

Opposed 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 be 100%, as reversing the bidi 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 Qt, and will produce correct results, as long as you feed one paragraph of text to the codec at a time. Places where newlines are supposed to start can be indicated by a newline character ('\n'). Please be aware, that these newline characters change the reordering behaviour of the algorithm, as the BiDi reordering only takes place within one line of text, whereas linebreaks are determined in visual order.

Visually ordered Hebrew is still used quite often in some places, mainly in email communication (as most email programs still don't understand logically ordered Hebrew) and on web pages. The use on web pages is strongly decreasing however, as there are nowadays a few browsers available 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 8bit string.

See also Internationalization with Qt.

## Member Function Documentation

### QCString QHebrewCodec::fromUnicode ( const QString & uc, int & len_in_out ) const`[virtual]`

Transforms the logically ordered QString, uc, into a visually ordered string in the 8859-8 encoding. Qt's BiDi algorithm is used to perform this task. Please note, that newline characters affect the reordering, as reordering is done on a line by line basis.

You might get wrong results if you feed the string line by line to this method, as the algorithm is designed to operate on a whole paragraph of text at a time, and the contents of a previous line may affect the reordering of the next line.

To ensure you get correct results always call this method with an entire paragraph of text to reorder.

Some encodings (for example japanese or utf8) are multibye (so one input character is mapped to two output characters). The len_in_out argument specifies the number of QChars that should be converted and is set to the number of characters returned.

Reimplemented from QTextCodec.

### const char * QHebrewCodec::mimeName () const`[virtual]`

Returns the codec's mime name.

Reimplemented from QTextCodec.

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