From mustafa_jamil at yahoo.com Fri Sep 8 19:09:01 2006 From: mustafa_jamil at yahoo.com (Mustafa Jamil) Date: Fri, 8 Sep 2006 12:09:01 -0700 (PDT) Subject: [Fedora-i18n-list] iconv help required Message-ID: <20060908190901.14980.qmail@web54506.mail.yahoo.com> Hey. I'm trying to write a simple C++ string converter that takes ISO-8859-1-encoded strings and converts them to UTF8-encoded strings. Unfortunately, iconv is dying with EILSEQ, and I don't know why. I'd appreciate any ideas you may have. Here's my test program (you can run it with 'g++ main.cpp; ./a.out'): -- START -- #include #include #include #include "errno.h" using namespace std; struct i18nError { i18nError(const std::string &m) : message(m) { } const std::string message; }; std::string ConvertString(const std::string& input, const std::string& from, const std::string& to) { cout << "DEBUG: Input string = " << input << endl; size_t input_bytes_to_read = input.size(); //returns the byte size cout << "DEBUG: input_bytes_to_read = " << input_bytes_to_read << endl; char *input_pointer = (char *)input.c_str(); //cast away the const size_t output_buffer_size = (input_bytes_to_read * 4) + 1; cout << "DEBUG: output_buffer_size = " << output_buffer_size << endl; size_t output_bytes_left = output_buffer_size; std::vector output_buffer(output_bytes_left); char *output_buffer_pointer = &output_buffer[0]; iconv_t cd = iconv_open(from.c_str(), to.c_str()); if (cd == (iconv_t) -1) { // Could not get suitable conversion descriptor if (errno == EINVAL) { throw i18nError("Conversion from " + from + " to " + to + " is not available"); } else { throw i18nError("iconv_open failed"); } } size_t nconv = iconv(cd, &input_pointer, &input_bytes_to_read, &output_buffer_pointer, &output_bytes_left); if (nconv == (size_t) -1) { std::string msg = "iconv failed, errno = "; if (errno == E2BIG) { msg += "E2BIG"; } else if (errno == EILSEQ) { msg += "EILSEQ"; } else if (errno == EINVAL) { msg += "EINVAL"; } else { msg += "Unknown"; } throw i18nError(msg); } if (iconv_close(cd) != 0) { throw i18nError("iconv_close failed"); } cout << "DEBUG: input_bytes_to_read = " << input_bytes_to_read << endl; cout << "DEBUG: nconv = " << nconv << endl; cout << "DEBUG: output_bytes_left = " << output_bytes_left << endl; size_t output_bytes_written = output_buffer_size - output_bytes_left; cout << "DEBUG: output_bytes_written = " << output_bytes_written << endl; if (output_bytes_written < output_buffer_size) { *output_buffer_pointer = '\0'; // explicitly null-terminate } std::string retVal = std::string(&output_buffer[0], output_buffer.size()); cout << "DEBUG: Output string = " << retVal << endl; cout << "DEBUG: Output string size = " << retVal.size() << endl; return (retVal); } main() { try { cout << "------------------------------------" << endl; std::string bar = ConvertString("Hello world", "ISO-8859-1", "UTF8"); cout << "------------------------------------" << endl; std::string baz = ConvertString("\xA2", "ISO-8859-1", "UTF8"); cout << "------------------------------------" << endl; } catch (i18nError e) { cout << e.message << endl; } } -- END -- And here's the output: ------------------------------------ DEBUG: Input string = Hello world DEBUG: input_bytes_to_read = 11 DEBUG: output_buffer_size = 45 DEBUG: input_bytes_to_read = 0 DEBUG: nconv = 0 DEBUG: output_bytes_left = 34 DEBUG: output_bytes_written = 11 DEBUG: Output string = Hello world DEBUG: Output string size = 45 ------------------------------------ DEBUG: Input string = � DEBUG: input_bytes_to_read = 1 DEBUG: output_buffer_size = 5 iconv failed, errno = EILSEQ I'd appreciate any help you can offer. Thanks! Mustafa __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From mustafa_jamil at yahoo.com Fri Sep 8 19:21:37 2006 From: mustafa_jamil at yahoo.com (Mustafa Jamil) Date: Fri, 8 Sep 2006 12:21:37 -0700 (PDT) Subject: [Fedora-i18n-list] Re: iconv help required Message-ID: <20060908192138.83763.qmail@web54512.mail.yahoo.com> Um, never mind. I have the from/to encodings reversed. :( --- Mustafa Jamil wrote: > Hey. > > I'm trying to write a simple C++ string converter > that > takes ISO-8859-1-encoded strings and converts them > to > UTF8-encoded strings. > > Unfortunately, iconv is dying with EILSEQ, and I > don't > know why. I'd appreciate any ideas you may have. > > Here's my test program (you can run it with 'g++ > main.cpp; ./a.out'): > > -- START -- > #include > #include > #include > #include "errno.h" > > using namespace std; > > struct i18nError { > i18nError(const std::string &m) : message(m) > { > } > const std::string message; > }; > > std::string > ConvertString(const std::string& input, > const std::string& from, > const std::string& to) > { > cout << "DEBUG: Input string = " << input << > endl; > size_t input_bytes_to_read = input.size(); > //returns the byte size > cout << "DEBUG: input_bytes_to_read = " << > input_bytes_to_read << endl; > char *input_pointer = (char *)input.c_str(); > //cast away the const > > size_t output_buffer_size = > (input_bytes_to_read * 4) + 1; > cout << "DEBUG: output_buffer_size = " << > output_buffer_size << endl; > size_t output_bytes_left = > output_buffer_size; > std::vector > output_buffer(output_bytes_left); > char *output_buffer_pointer = > &output_buffer[0]; > > iconv_t cd = iconv_open(from.c_str(), > to.c_str()); > if (cd == (iconv_t) -1) { > // Could not get suitable conversion > descriptor > if (errno == EINVAL) { > throw i18nError("Conversion > from " + from + " to " + to + " is not available"); > } else { > throw i18nError("iconv_open > failed"); > } > } > > size_t nconv = iconv(cd, > &input_pointer, > &input_bytes_to_read, > &output_buffer_pointer, > &output_bytes_left); > if (nconv == (size_t) -1) { > std::string msg = "iconv failed, > errno > = "; > if (errno == E2BIG) { > msg += "E2BIG"; > } else if (errno == EILSEQ) { > msg += "EILSEQ"; > } else if (errno == EINVAL) { > msg += "EINVAL"; > } else { > msg += "Unknown"; > } > throw i18nError(msg); > } > > if (iconv_close(cd) != 0) { > throw i18nError("iconv_close > failed"); > } > cout << "DEBUG: input_bytes_to_read = " << > input_bytes_to_read << endl; > cout << "DEBUG: nconv = " << nconv << endl; > > cout << "DEBUG: output_bytes_left = " << > output_bytes_left << endl; > size_t output_bytes_written = > output_buffer_size - output_bytes_left; > cout << "DEBUG: output_bytes_written = " << > output_bytes_written > << endl; > if (output_bytes_written < > output_buffer_size) > { > *output_buffer_pointer = '\0'; // > explicitly null-terminate > } > > std::string retVal = > std::string(&output_buffer[0], > output_buffer.size()); > cout << "DEBUG: Output string = " << retVal > << > endl; > cout << "DEBUG: Output string size = " << > retVal.size() << endl; > return (retVal); > } > > main() > { > try { > cout << > "------------------------------------" << endl; > std::string bar = > ConvertString("Hello > world", "ISO-8859-1", "UTF8"); > cout << > "------------------------------------" << endl; > std::string baz = > ConvertString("\xA2", "ISO-8859-1", "UTF8"); > cout << > "------------------------------------" << endl; > } catch (i18nError e) { > cout << e.message << endl; > } > } > -- END -- > > And here's the output: > > ------------------------------------ > DEBUG: Input string = Hello world > DEBUG: input_bytes_to_read = 11 > DEBUG: output_buffer_size = 45 > DEBUG: input_bytes_to_read = 0 > DEBUG: nconv = 0 > DEBUG: output_bytes_left = 34 > DEBUG: output_bytes_written = 11 > DEBUG: Output string = Hello world > DEBUG: Output string size = 45 > ------------------------------------ > DEBUG: Input string = ??? > DEBUG: input_bytes_to_read = 1 > DEBUG: output_buffer_size = 5 > iconv failed, errno = EILSEQ > > I'd appreciate any help you can offer. > > Thanks! > > Mustafa > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam > protection around > http://mail.yahoo.com > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From kwade at redhat.com Tue Sep 26 15:02:18 2006 From: kwade at redhat.com (Karsten Wade) Date: Tue, 26 Sep 2006 08:02:18 -0700 Subject: [Fedora-i18n-list] [Fwd: new RELEASE-NOTES.pot available] Message-ID: <1159282938.10103.214.camel@erato.phig.org> Leon: Can you help us out here? Someone in Fedora Trans is supposed to load this POT file into i18n.r.c so it could be translate for FC6 ISO. This is the schedule we've been working from: http://fedoraproject.org/wiki/DocsProject/Schedule#relnotes-schedule The PO files must be back by 30 Sep. to make it into the ISO. thanks - Karsten -------- Forwarded Message -------- From: Karsten Wade Reply-To: kwade at redhat.com, Fedora Translation Project List To: fedora-trans-list at redhat.com Subject: new RELEASE-NOTES.pot available Date: Tue, 26 Sep 2006 03:19:02 -0700 The new release notes POT file is available. We matched the tagging to use the same tags as in test3. Hopefully this reduces the false fuzzy and false untranslatable entries. asalam - Please check this POT file and confirm that it is OK for inclusion in i18n.redhat.com. Upload it ASAP. Thanks - Karsten -- Fedora-trans-list mailing list Fedora-trans-list at redhat.com https://www.redhat.com/mailman/listinfo/fedora-trans-list -- Karsten Wade, RHCE, 108 Editor ^ Fedora Documentation Project Sr. Developer Relations Mgr. | fedoraproject.org/wiki/DocsProject quaid.108.redhat.com | gpg key: AD0E0C41 ////////////////////////////////// \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From llch at redhat.com Thu Sep 28 07:10:32 2006 From: llch at redhat.com (Leon Ho) Date: Thu, 28 Sep 2006 17:10:32 +1000 Subject: [Fedora-i18n-list] Re: [Fwd: new RELEASE-NOTES.pot available] In-Reply-To: <1159282938.10103.214.camel@erato.phig.org> References: <1159282938.10103.214.camel@erato.phig.org> Message-ID: <200609281710.32878.llch@redhat.com> Hi Karsten, Aman has just done it now (even though he is on leave). Let me know if you have any other problems. Regards, Leon On Wednesday 27 September 2006 01:02, Karsten Wade wrote: > Leon: > > Can you help us out here? Someone in Fedora Trans is supposed to load > this POT file into i18n.r.c so it could be translate for FC6 ISO. > > This is the schedule we've been working from: > > http://fedoraproject.org/wiki/DocsProject/Schedule#relnotes-schedule > > The PO files must be back by 30 Sep. to make it into the ISO. > > thanks - Karsten > > -------- Forwarded Message -------- > From: Karsten Wade > Reply-To: kwade at redhat.com, Fedora Translation Project List > > To: fedora-trans-list at redhat.com > Subject: new RELEASE-NOTES.pot available > Date: Tue, 26 Sep 2006 03:19:02 -0700 > > The new release notes POT file is available. > > We matched the tagging to use the same tags as in test3. Hopefully this > reduces the false fuzzy and false untranslatable entries. > > asalam - Please check this POT file and confirm that it is OK for > inclusion in i18n.redhat.com. Upload it ASAP. > > Thanks - Karsten > -- > Fedora-trans-list mailing list > Fedora-trans-list at redhat.com > https://www.redhat.com/mailman/listinfo/fedora-trans-list From linux_kernel_worm at yahoo.com Thu Sep 28 10:32:28 2006 From: linux_kernel_worm at yahoo.com (Tahir Abdul Rauf Butt) Date: Thu, 28 Sep 2006 11:32:28 +0100 (BST) Subject: [Fedora-i18n-list] Help for Installer Translation!! Message-ID: <20060928103228.70091.qmail@web55202.mail.re4.yahoo.com> Hi, Pre-Req: I have studied the documentation for translation of debian. Help: New please tell me how and where to get the installer source code, so that I could translate the po files and compile the installer to see the results. I am very much confused in how to get installer and how to compile it to see the results.. Tahir Rauf Butt Bsc(Hons). CS PU College of IT www.geocities.com\linux_kernel_worm Send instant messages to your online friends http://uk.messenger.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From sankarshan at randomink.org Thu Sep 28 10:41:42 2006 From: sankarshan at randomink.org (Sankarshan Mukhopadhyay) Date: Thu, 28 Sep 2006 16:11:42 +0530 Subject: [Fedora-i18n-list] Help for Installer Translation!! In-Reply-To: <20060928103228.70091.qmail@web55202.mail.re4.yahoo.com> References: <20060928103228.70091.qmail@web55202.mail.re4.yahoo.com> Message-ID: <451BA6E6.5060809@randomink.org> Tahir Abdul Rauf Butt wrote: > Pre-Req: > > I have studied the documentation for translation of debian. Interesting. What about the bits for Fedora ? :) > > Help: > > New please tell me how and where to get the installer source code, so > that I could translate the po files and compile the installer to see the > results. The Fedora Translation Project ? http://fedora.redhat.com/About/Projects/translations/ > I am very much confused in how to get installer and how to compile it to > see the results.. That sort of figures from your statement above :) :SM -- >From Untruth, lead me to the Truth, >From Darkness, Lead me towards the Light, >From Death, Lead me to Life Eternal.