Lars Gullik Bjønnes wrote:
> Georg Baum <[EMAIL PROTECTED]>
> writes:
>
> So far I have only created what I needed. But even if we add more
> convenience fuctions we should be careful when adding them, we do not
> want to many imho.
Yes. We'll see what is useful as the conversion goes on.
> | Or should we not change the type, but use utf8 as encoding instead? I
> | believe the former is safer.
>
> This is one of the things I am thinking about... esp. in rel. to
> gettext and l10n.
>
> Should a call to gettext (_()) give us utf8 or ucs4?, so far I am
> inclined to go for utf8.
If we only knew which variant results in less conversions. Since the po
files will eventually be in utf8 it seems natural to use utf8 for _(), too.
If we do that we should declare that all std::strings that are used are in
utf8 encoding, unless otherwise noted. Apart from LaTeX output I see so far
no use for any other 8bit encoing than utf8. That would also mean that we'd
need to change toqstr/fromqstr.
I'll have a closer look at the toc business. I hope that will give an
impression what is better.
> | Index: src/output_plaintext.C
> | ===================================================================
> | --- src/output_plaintext.C (Revision 14695)
> | +++ src/output_plaintext.C (Arbeitskopie)
> | @@ -232,8 +233,10 @@ void asciiParagraph(Buffer const & buf,
> | "writeAsciiFile: NULL char in structure." << endl;
> | break;
> |
> | - default:
> | - word += c;
> | + default: {
> | + std::vector<char> tmp = ucs4_to_utf8(c);
> | + tmp.push_back('\0');
> | + word += &tmp[0];
>
> What is word? a std::string?
Yes.
> std::vector<char> tmp = ucs4_to_utf8(c);
> word.append(tmp.begin(), tmp.end());
Of course. I'll put that version in.
Georg