Re: [fw-general] Zend_Translate in iso-8859-1
hi all, Thomas has fixed the bug in the current subversion trunk (if you're using that). http://framework.zend.com/issues/browse/ZF-3439 svn up and all works like a charm! thank you so much thomas and pádraic. yours. pierre. -- Liip AG // Rte de la Fonderie 7 // CH-1700 Fribourg Fon 026 4222511 // Key id 0x5BF5F8FA // www.liip.ch PGP.sig Description: This is a digitally signed message part
Re: [fw-general] Zend_Translate in iso-8859-1
Try it now Pierre, Thomas has fixed the bug in the current subversion trunk (if you're using that). Paddy Pádraic Brady http://blog.astrumfutura.com http://www.patternsforphp.com OpenID Europe Foundation - Original Message From: Spring Pierre <[EMAIL PROTECTED]> To: Pádraic Brady <[EMAIL PROTECTED]> Sent: Wednesday, June 11, 2008 5:30:06 PM Subject: Re: [fw-general] Zend_Translate in iso-8859-1 dear paddy, > I wrote up a quick test which may help. I've opened up a new issue > since it > seems to be a real bug unless two of us are completely messing up > somewhere > (never say never ;)). > > http://framework.zend.com/issues/browse/ZF-3439 thank you very much ... that is how i should have done it in the first place, i guess ;) yours ... pierre -- Liip AG // Rte de la Fonderie 7 // CH-1700 Fribourg Fon 026 4222511 // Key id 0x5BF5F8FA // www.liip.ch
Re: [fw-general] Zend_Translate in iso-8859-1
I wrote up a quick test which may help. I've opened up a new issue since it seems to be a real bug unless two of us are completely messing up somewhere (never say never ;)). http://framework.zend.com/issues/browse/ZF-3439 Another quick look shows all XML adapters are open to the same problem, since they also use xml_parser_create without setting an output encoding matching input. Best regards, Paddy Pádraic Brady wrote: > > Hi Thomas, > >>First: Zend_Translate can not handle bilge pumps. I think you meant the >>ISO-8859-1 standard. > > A slip of the finger, dear Watson ;) > >>Zend_Translate does not change any source... if your source is UTF you will >>get UTF. If it's Win1503 you will get Win 1503... > > I'm going to be a pain in the butt (until I realise I'm wrong and slink > away embarrassed ;)). I did a quick test since it seemed a bit odd, and > I'm getting the same result. The input's strlen is 1, and the output's is > 2. Somewhere along the line, and my guess is xml_parser_create() as > suggested, a single byte character miraculously transformed into a double > byte u+diacritic. Adding the optional ISO-8859-1 encoding output option to > xml_parser_create() in the TMX adapter corrects the problem and reverts to > outputting the single-byte umlaut. > > I'm not an expert here, so I could be off the wall. The PHP docs state > that input encoding is detected from the input source, but the output is > independently encoded as UTF-8 by default since PHP 5.0.2. So Pierre's > input, without further changes, is indeed output under UTF-8. > Specifically, the ISO-8859-1 umlaut becomes a double-byte UTF-8 u with a > diacritic attached. That at least explains the mangled output Pierre is > getting - the browser is simple taking the Content-Type seriously and > printing the two bytes as separate chars. > > Like I said, I could be completely wrong, or using a bad test case. But > something doesn't add up right now. > > Best regards, > Paddy > > Pádraic Brady > > http://blog.astrumfutura.com > http://www.patternsforphp.com > OpenID Europe Foundation > > > > > ----- Original Message > From: Thomas Weidner <[EMAIL PROTECTED]> > Cc: Zend Framework General > Sent: Tuesday, June 10, 2008 8:54:13 PM > Subject: Re: [fw-general] Zend_Translate in iso-8859-1 > > I already answered his question 17:04 CET. > > Just 2 things: > > First: Zend_Translate can not handle bilge pumps. I think you meant the > ISO-8859-1 standard. > Second: I am using the western european standard myself in the testbed and > in my applications without any problems. > > Zend_Translate does not change any source... if your source is UTF you > will > get UTF. If it's Win1503 you will get Win 1503... > > Greetings > Thomas Weidner, I18N Team Leader, Zend Framework > http://www.thomasweidner.com > > - Original Message - > From: "Pádraic Brady" <[EMAIL PROTECTED]> > To: "Spring Pierre" <[EMAIL PROTECTED]> > Cc: "Zend Framework General" > Sent: Tuesday, June 10, 2008 9:27 PM > Subject: Re: [fw-general] Zend_Translate in iso-8859-1 > > > Maybe Thomas can clarify, since I don't use ISO-8849-1, but in the TMX > adapter I noted it's using the XML Parser extension but it doesn't specify > an output encoding. As far as I know the default out encoding, independent > of the input encoding, is UTF-8. Could this be creating a subtle encoding > transfer? In goes ISO-8849-1, out comes slightly corrupted UTF-8 for > Pierre's 00F6 umlauts? > > Pádraic Brady > > http://blog.astrumfutura.com > http://www.patternsforphp.com > OpenID Europe Foundation Member-Subscriber > > > > > - Original Message > From: Spring Pierre <[EMAIL PROTECTED]> > To: Wolfgang Forstmeier <[EMAIL PROTECTED]> > Cc: fw-general@lists.zend.com > Sent: Tuesday, June 10, 2008 4:17:54 PM > Subject: Re: [fw-general] Zend_Translate in iso-8859-1 > > dear wolfgang, > >>> i build a Zend_Form and need the validation messages to be >>> translated. >>> >>> i wrote an xml file with the error messages [1]. i tried both, an >>> iso-8859-1 >>> and utf-8 version of the xml file. >>> >>> i then attach the translation to the form and render it. cf. [2] >>> >>> i seem to have a problem with encoding though. > >> Maybe some more description what is going wrong would be nice. >> What is really wrong ? > > the encoding seems to be wrong . i'd need to output ISO-8859-1, yet > it outputs UTF-8. >
Re: [fw-general] Zend_Translate in iso-8859-1
Hi Thomas, >First: Zend_Translate can not handle bilge pumps. I think you meant the >ISO-8859-1 standard. A slip of the finger, dear Watson ;) >Zend_Translate does not change any source... if your source is UTF you will >get UTF. If it's Win1503 you will get Win 1503... I'm going to be a pain in the butt (until I realise I'm wrong and slink away embarrassed ;)). I did a quick test since it seemed a bit odd, and I'm getting the same result. The input's strlen is 1, and the output's is 2. Somewhere along the line, and my guess is xml_parser_create() as suggested, a single byte character miraculously transformed into a double byte u+diacritic. Adding the optional ISO-8859-1 encoding output option to xml_parser_create() in the TMX adapter corrects the problem and reverts to outputting the single-byte umlaut. I'm not an expert here, so I could be off the wall. The PHP docs state that input encoding is detected from the input source, but the output is independently encoded as UTF-8 by default since PHP 5.0.2. So Pierre's input, without further changes, is indeed output under UTF-8. Specifically, the ISO-8859-1 umlaut becomes a double-byte UTF-8 u with a diacritic attached. That at least explains the mangled output Pierre is getting - the browser is simple taking the Content-Type seriously and printing the two bytes as separate chars. Like I said, I could be completely wrong, or using a bad test case. But something doesn't add up right now. Best regards, Paddy Pádraic Brady http://blog.astrumfutura.com http://www.patternsforphp.com OpenID Europe Foundation - Original Message From: Thomas Weidner <[EMAIL PROTECTED]> Cc: Zend Framework General Sent: Tuesday, June 10, 2008 8:54:13 PM Subject: Re: [fw-general] Zend_Translate in iso-8859-1 I already answered his question 17:04 CET. Just 2 things: First: Zend_Translate can not handle bilge pumps. I think you meant the ISO-8859-1 standard. Second: I am using the western european standard myself in the testbed and in my applications without any problems. Zend_Translate does not change any source... if your source is UTF you will get UTF. If it's Win1503 you will get Win 1503... Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: "Pádraic Brady" <[EMAIL PROTECTED]> To: "Spring Pierre" <[EMAIL PROTECTED]> Cc: "Zend Framework General" Sent: Tuesday, June 10, 2008 9:27 PM Subject: Re: [fw-general] Zend_Translate in iso-8859-1 Maybe Thomas can clarify, since I don't use ISO-8849-1, but in the TMX adapter I noted it's using the XML Parser extension but it doesn't specify an output encoding. As far as I know the default out encoding, independent of the input encoding, is UTF-8. Could this be creating a subtle encoding transfer? In goes ISO-8849-1, out comes slightly corrupted UTF-8 for Pierre's 00F6 umlauts? Pádraic Brady http://blog.astrumfutura.com http://www.patternsforphp.com OpenID Europe Foundation Member-Subscriber - Original Message From: Spring Pierre <[EMAIL PROTECTED]> To: Wolfgang Forstmeier <[EMAIL PROTECTED]> Cc: fw-general@lists.zend.com Sent: Tuesday, June 10, 2008 4:17:54 PM Subject: Re: [fw-general] Zend_Translate in iso-8859-1 dear wolfgang, >> i build a Zend_Form and need the validation messages to be >> translated. >> >> i wrote an xml file with the error messages [1]. i tried both, an >> iso-8859-1 >> and utf-8 version of the xml file. >> >> i then attach the translation to the form and render it. cf. [2] >> >> i seem to have a problem with encoding though. > Maybe some more description what is going wrong would be nice. > What is really wrong ? the encoding seems to be wrong . i'd need to output ISO-8859-1, yet it outputs UTF-8. the xml file i read the translations from is in ISO-8859-1 ... c.f. screenshot [1] greetings ... pierre == [1] http://wiki.caillou.ch/_media/code:zend_translate_encoding_problem.png -- Liip AG // Rte de la Fonderie 7 // CH-1700 Fribourg Fon 026 4222511 // Key id 0x5BF5F8FA // www.liip.ch
Re: [fw-general] Zend_Translate in iso-8859-1
Hi Thomas, >First: Zend_Translate can not handle bilge pumps. I think you meant the >ISO-8859-1 standard. A slip of the finger, dear Watson ;) >Zend_Translate does not change any source... if your source is UTF you will >get UTF. If it's Win1503 you will get Win 1503... I'm going to be a pain in the butt (until I realise I'm wrong and slink away embarrassed ;)). I did a quick test since it seemed a bit odd, and I'm getting the same result. The input's strlen is 1, and the output's is 2. Somewhere along the line, and my guess is xml_parser_create() as suggested, a single byte character miraculously transformed into a double byte u+diacritic. Adding the optional ISO-8859-1 encoding output option to xml_parser_create() in the TMX adapter corrects the problem and reverts to outputting the single-byte umlaut. I'm not an expert here, so I could be off the wall. The PHP docs state that input encoding is detected from the input source, but the output is independently encoded as UTF-8 by default since PHP 5.0.2. So Pierre's input, without further changes, is indeed output under UTF-8. Specifically, the ISO-8859-1 umlaut becomes a double-byte UTF-8 u with a diacritic attached. That at least explains the mangled output Pierre is getting - the browser is simple taking the Content-Type seriously and printing the two bytes as separate chars. Like I said, I could be completely wrong, or using a bad test case. But something doesn't add up right now. Best regards, Paddy Pádraic Brady http://blog.astrumfutura.com http://www.patternsforphp.com OpenID Europe Foundation - Original Message From: Thomas Weidner <[EMAIL PROTECTED]> Cc: Zend Framework General Sent: Tuesday, June 10, 2008 8:54:13 PM Subject: Re: [fw-general] Zend_Translate in iso-8859-1 I already answered his question 17:04 CET. Just 2 things: First: Zend_Translate can not handle bilge pumps. I think you meant the ISO-8859-1 standard. Second: I am using the western european standard myself in the testbed and in my applications without any problems. Zend_Translate does not change any source... if your source is UTF you will get UTF. If it's Win1503 you will get Win 1503... Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: "Pádraic Brady" <[EMAIL PROTECTED]> To: "Spring Pierre" <[EMAIL PROTECTED]> Cc: "Zend Framework General" Sent: Tuesday, June 10, 2008 9:27 PM Subject: Re: [fw-general] Zend_Translate in iso-8859-1 Maybe Thomas can clarify, since I don't use ISO-8849-1, but in the TMX adapter I noted it's using the XML Parser extension but it doesn't specify an output encoding. As far as I know the default out encoding, independent of the input encoding, is UTF-8. Could this be creating a subtle encoding transfer? In goes ISO-8849-1, out comes slightly corrupted UTF-8 for Pierre's 00F6 umlauts? Pádraic Brady http://blog.astrumfutura.com http://www.patternsforphp.com OpenID Europe Foundation Member-Subscriber - Original Message From: Spring Pierre <[EMAIL PROTECTED]> To: Wolfgang Forstmeier <[EMAIL PROTECTED]> Cc: fw-general@lists.zend.com Sent: Tuesday, June 10, 2008 4:17:54 PM Subject: Re: [fw-general] Zend_Translate in iso-8859-1 dear wolfgang, >> i build a Zend_Form and need the validation messages to be >> translated. >> >> i wrote an xml file with the error messages [1]. i tried both, an >> iso-8859-1 >> and utf-8 version of the xml file. >> >> i then attach the translation to the form and render it. cf. [2] >> >> i seem to have a problem with encoding though. > Maybe some more description what is going wrong would be nice. > What is really wrong ? the encoding seems to be wrong . i'd need to output ISO-8859-1, yet it outputs UTF-8. the xml file i read the translations from is in ISO-8859-1 ... c.f. screenshot [1] greetings ... pierre == [1] http://wiki.caillou.ch/_media/code:zend_translate_encoding_problem.png -- Liip AG // Rte de la Fonderie 7 // CH-1700 Fribourg Fon 026 4222511 // Key id 0x5BF5F8FA // www.liip.ch
Re: [fw-general] Zend_Translate in iso-8859-1
I already answered his question 17:04 CET. Just 2 things: First: Zend_Translate can not handle bilge pumps. I think you meant the ISO-8859-1 standard. Second: I am using the western european standard myself in the testbed and in my applications without any problems. Zend_Translate does not change any source... if your source is UTF you will get UTF. If it's Win1503 you will get Win 1503... Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: "Pádraic Brady" <[EMAIL PROTECTED]> To: "Spring Pierre" <[EMAIL PROTECTED]> Cc: "Zend Framework General" Sent: Tuesday, June 10, 2008 9:27 PM Subject: Re: [fw-general] Zend_Translate in iso-8859-1 Maybe Thomas can clarify, since I don't use ISO-8849-1, but in the TMX adapter I noted it's using the XML Parser extension but it doesn't specify an output encoding. As far as I know the default out encoding, independent of the input encoding, is UTF-8. Could this be creating a subtle encoding transfer? In goes ISO-8849-1, out comes slightly corrupted UTF-8 for Pierre's 00F6 umlauts? Pádraic Brady http://blog.astrumfutura.com http://www.patternsforphp.com OpenID Europe Foundation Member-Subscriber - Original Message From: Spring Pierre <[EMAIL PROTECTED]> To: Wolfgang Forstmeier <[EMAIL PROTECTED]> Cc: fw-general@lists.zend.com Sent: Tuesday, June 10, 2008 4:17:54 PM Subject: Re: [fw-general] Zend_Translate in iso-8859-1 dear wolfgang, i build a Zend_Form and need the validation messages to be translated. i wrote an xml file with the error messages [1]. i tried both, an iso-8859-1 and utf-8 version of the xml file. i then attach the translation to the form and render it. cf. [2] i seem to have a problem with encoding though. Maybe some more description what is going wrong would be nice. What is really wrong ? the encoding seems to be wrong . i'd need to output ISO-8859-1, yet it outputs UTF-8. the xml file i read the translations from is in ISO-8859-1 ... c.f. screenshot [1] greetings ... pierre == [1] http://wiki.caillou.ch/_media/code:zend_translate_encoding_problem.png -- Liip AG // Rte de la Fonderie 7 // CH-1700 Fribourg Fon 026 4222511 // Key id 0x5BF5F8FA // www.liip.ch
Re: [fw-general] Zend_Translate in iso-8859-1
Maybe Thomas can clarify, since I don't use ISO-8849-1, but in the TMX adapter I noted it's using the XML Parser extension but it doesn't specify an output encoding. As far as I know the default out encoding, independent of the input encoding, is UTF-8. Could this be creating a subtle encoding transfer? In goes ISO-8849-1, out comes slightly corrupted UTF-8 for Pierre's 00F6 umlauts? Pádraic Brady http://blog.astrumfutura.com http://www.patternsforphp.com OpenID Europe Foundation Member-Subscriber - Original Message From: Spring Pierre <[EMAIL PROTECTED]> To: Wolfgang Forstmeier <[EMAIL PROTECTED]> Cc: fw-general@lists.zend.com Sent: Tuesday, June 10, 2008 4:17:54 PM Subject: Re: [fw-general] Zend_Translate in iso-8859-1 dear wolfgang, >> i build a Zend_Form and need the validation messages to be >> translated. >> >> i wrote an xml file with the error messages [1]. i tried both, an >> iso-8859-1 >> and utf-8 version of the xml file. >> >> i then attach the translation to the form and render it. cf. [2] >> >> i seem to have a problem with encoding though. > Maybe some more description what is going wrong would be nice. > What is really wrong ? the encoding seems to be wrong . i'd need to output ISO-8859-1, yet it outputs UTF-8. the xml file i read the translations from is in ISO-8859-1 ... c.f. screenshot [1] greetings ... pierre == [1] http://wiki.caillou.ch/_media/code:zend_translate_encoding_problem.png -- Liip AG // Rte de la Fonderie 7 // CH-1700 Fribourg Fon 026 4222511 // Key id 0x5BF5F8FA // www.liip.ch
Re: [fw-general] Zend_Translate in iso-8859-1
Maybe Thomas can clarify, since I don't use ISO-8849-1, but in the TMX adapter I noted it's using the XML Parser extension but it doesn't specify an output encoding. As far as I know the default out encoding, independent of the input encoding, is UTF-8. Could this be creating a subtle encoding transfer? In goes ISO-8849-1, out comes slightly corrupted UTF-8 for Pierre's 00F6 umlauts? Pádraic Brady http://blog.astrumfutura.com http://www.patternsforphp.com OpenID Europe Foundation Member-Subscriber - Original Message From: Spring Pierre <[EMAIL PROTECTED]> To: Wolfgang Forstmeier <[EMAIL PROTECTED]> Cc: fw-general@lists.zend.com Sent: Tuesday, June 10, 2008 4:17:54 PM Subject: Re: [fw-general] Zend_Translate in iso-8859-1 dear wolfgang, >> i build a Zend_Form and need the validation messages to be >> translated. >> >> i wrote an xml file with the error messages [1]. i tried both, an >> iso-8859-1 >> and utf-8 version of the xml file. >> >> i then attach the translation to the form and render it. cf. [2] >> >> i seem to have a problem with encoding though. > Maybe some more description what is going wrong would be nice. > What is really wrong ? the encoding seems to be wrong . i'd need to output ISO-8859-1, yet it outputs UTF-8. the xml file i read the translations from is in ISO-8859-1 ... c.f. screenshot [1] greetings ... pierre == [1] http://wiki.caillou.ch/_media/code:zend_translate_encoding_problem.png -- Liip AG // Rte de la Fonderie 7 // CH-1700 Fribourg Fon 026 4222511 // Key id 0x5BF5F8FA // www.liip.ch
Re: [fw-general] Zend_Translate in iso-8859-1
dear wolfgang, i build a Zend_Form and need the validation messages to be translated. i wrote an xml file with the error messages [1]. i tried both, an iso-8859-1 and utf-8 version of the xml file. i then attach the translation to the form and render it. cf. [2] i seem to have a problem with encoding though. Maybe some more description what is going wrong would be nice. What is really wrong ? the encoding seems to be wrong . i'd need to output ISO-8859-1, yet it outputs UTF-8. the xml file i read the translations from is in ISO-8859-1 ... c.f. screenshot [1] greetings ... pierre == [1] http://wiki.caillou.ch/_media/code:zend_translate_encoding_problem.png -- Liip AG // Rte de la Fonderie 7 // CH-1700 Fribourg Fon 026 4222511 // Key id 0x5BF5F8FA // www.liip.ch PGP.sig Description: This is a digitally signed message part
Re: [fw-general] Zend_Translate in iso-8859-1
Pierre, what's your problem ??? Zend_Translate does not convert any input. When your source is ISO then Zend_Translate will also return ISO. When your source is kyrillic it will return kyrillic and visa versa. Can you explain where your problem with Zend_Translate is ? Have you tried to translate your messages manually ? Does this work ? What's the input, what's the output, what've you expected, what've you tried, which release are u using and and and... Without any further informations your mail is quite useless from the point of a helping hand. Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com - Original Message - From: "Spring Pierre" <[EMAIL PROTECTED]> To: Sent: Tuesday, June 10, 2008 4:01 PM Subject: [fw-general] Zend_Translate in iso-8859-1 hi all, before i get into the core of my problem, i'd like to point out that switching to UTF-8 is not a solution for my problem, taken that i merely add a roof to a card-house ... the server i work on (some intraweb behind a vpn) sends resposne headers set to iso-8859-1, as is the tag. i build a Zend_Form and need the validation messages to be translated. i wrote an xml file with the error messages [1]. i tried both, an iso-8859-1 and utf-8 version of the xml file. i then attach the translation to the form and render it. cf. [2] i seem to have a problem with encoding though. does this ring a bell to anyone? greetings ... pierre == links [1] http://wiki.caillou.ch/_media/code:validatorsstrings.g.xml [2] http://paste2.org/p/37728 for syntax highlighted == code $this->form->setAction('.') ->setMethod('post') ->setAttrib('enctype', 'multipart/form-data'); # set the translator $translator = new Zend_Translate( 'Zend_Translate_Adapter_Tmx', $translation_file, 'de' ); $this->form->setTranslator($translator); # add some elements # [...] if ($_POST) { $form->isValid($_POST); } $view = new Zend_View(); $view->setEncoding('ISO-8859-1'); echo $form->render($view); -- Liip AG // Rte de la Fonderie 7 // CH-1700 Fribourg Fon 026 4222511 // Key id 0x5BF5F8FA // www.liip.ch
[fw-general] Zend_Translate in iso-8859-1
hi all, before i get into the core of my problem, i'd like to point out that switching to UTF-8 is not a solution for my problem, taken that i merely add a roof to a card-house ... the server i work on (some intraweb behind a vpn) sends resposne headers set to iso-8859-1, as is the tag. i build a Zend_Form and need the validation messages to be translated. i wrote an xml file with the error messages [1]. i tried both, an iso-8859-1 and utf-8 version of the xml file. i then attach the translation to the form and render it. cf. [2] i seem to have a problem with encoding though. does this ring a bell to anyone? greetings ... pierre == links [1] http://wiki.caillou.ch/_media/code:validatorsstrings.g.xml [2] http://paste2.org/p/37728 for syntax highlighted == code $this->form->setAction('.') ->setMethod('post') ->setAttrib('enctype', 'multipart/form-data'); # set the translator $translator = new Zend_Translate( 'Zend_Translate_Adapter_Tmx', $translation_file, 'de' ); $this->form->setTranslator($translator); # add some elements # [...] if ($_POST) { $form->isValid($_POST); } $view = new Zend_View(); $view->setEncoding('ISO-8859-1'); echo $form->render($view); -- Liip AG // Rte de la Fonderie 7 // CH-1700 Fribourg Fon 026 4222511 // Key id 0x5BF5F8FA // www.liip.ch PGP.sig Description: This is a digitally signed message part