Re: hilghlighting



On Tue, 2010-05-11 at 12:09 +0200, deloptes wrote: 
> 3rdShift wrote:
> 
> > Both Gtk::Label and Gtk::TextView support Pango markup which gives you
> > more then enough to accentuate your text.
> > 
> > http://library.gnome.org/devel/pango/stable/PangoMarkupFormat.html
> > 
> 
> A question rises here: this pango link is for C 

The link provides authoritative information about using the pango markup
language so it will still be useful if you're coding in C++.  The
pangomm docs can be reached from the library.gnome.org C++ section:

http://library.gnome.org/devel/references#c++-bindings


> also gtkmm docs state
> something I'm not sure is true.
> 
> "One of the benefits of UTF-8 is that you don't need to use it unless you
> want to, so you don't need to retrofit all of your code at once.
> std::string will still work for 7-bit ASCII strings. But when you try to
> localize your application for languages like Chinese, for instance, you
> will start to see strange errors, and possible crashes. Then all you need
> to do is start using Glib::ustring instead.
> 
> Note that UTF-8 isn't compatible with 8-bit encodings like ISO-8859-1. For
> instance, German umlauts are not in the ASCII range and need more than 1
> byte in the UTF-8 encoding. If your code contains 8-bit string literals,
> you have to convert them to UTF-8 (e.g. the Bavarian greeting "Grüß Gott"
> would be "Gr\xC3\xBC\xC3\x9F Gott")."
> http://library.gnome.org/devel/gtkmm-tutorial/unstable/sec-basics-ustring.html.de

The point of the docs is to explain the differences between UTF-8 (which
is a multi-byte encoding) and single-byte encodings.

> 
> I think currently most systems are utf and are using (8bit) utf by default
> and I have never had to think about it in the past few years.
> about 5years ago it was a nightmare

What about systems not using UTF-8?  Windows systems?

> 
> ----------
> example : cat test.cc
> 
> #include <string>
> #include <iostream>
> using namespace std;
> 
> int main () {
>         string a = "Test ascii";
>         string b = "Grüß Gott!";
> 
>         cout << "A test: " << a << endl;
>         cout << "German: " << b << endl;
> return 0;
> }
> 
> ./a.out
> A test: Test ascii
> German: Grüß Gott!

On Windows (using MinGW), the output is garbled:

$ ./a
A test: Test ascii
German: Grⁿ▀ Gott!

-- 
José






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]