Hi,
i port some data from Pharo to GLASS with SIXX. Now when into GLASS i create a object with: Object readSixxFrom: '<sixx.object sixx.id="13" sixx.name="commento" sixx.type="String">La nostra esperienza si tramanda da generazioni, fin dal 1924, e grazie a continui aggiornamenti siamo sempre più specializzati nella fornitura di uffici, aziende, scuole ed enti pubblici. Alla nostra Clientela assicuriamo un servizio accurato e tempestivo, svolto con professionalità, attenzione e cortesia. Venite a trovarci a Clusone, in Via San Vincenzo de Paoli n.9, oppure contattateci telefonicamente al numero 034623833.</sixx.object>' the system erase the error: AbstractException >> _signalFromPrimitive: (envId 0) String >> decodeFromUTF8 (envId 0) String class >> createInstanceOf:withSixxElement: (envId 0) Behavior >> newInstanceFromSixxElement:context: (envId 0) Behavior >> fromSixxElement:context: (envId 0) Behavior >> readSixxFromSixxElement:context: (envId 0) Behavior >> readSixxFrom:context:persistentRoot: (envId 0) Behavior >> readSixxFrom: (envId 0) Executed Code String >> evaluateInContext:symbolList: (envId 0) JadeServer >> evaluate:inContext: (envId 0) JadeServer >> printIt:in: (envId 0) GsNMethod class >> _gsReturnToC (envId 0) I change the String class method createInstanceOf: aClass withSixxElement: sixxElement ^ (SixxXmlUtil characterDataFrom: sixxElement) decodeFromUTF8 asString removing the decodeFromUTF8. With this modification the system works fine but it's right solutions? I need to do some change in Pharo? Thanks for any considerations. Dario |
Dario,
The code that sends decodeFromUTF8 expects that the strings are encoded in UTF8 .. in your example you are passing in an unencoded string that contains caracters beyond the 7bitASCII range (The encoding for 7bit ascii characters and UTF8 are identical), So your example should work if you encode the string passed into #readSixxFrom: in UTF8 using #encodeAsUTF8. Dale ----- Original Message ----- | From: "Dario Trussardi" <[hidden email]> | To: "beta discussion Gemstone Seaside" <[hidden email]> | Sent: Wednesday, December 12, 2012 7:28:14 AM | Subject: [GS/SS Beta] String UTF error from sixx string | | Hi, | | i port some data from Pharo to GLASS with SIXX. | | | Now when into GLASS i create a object with: | | Object readSixxFrom: '<sixx.object sixx.id="13" sixx.name="commento" | sixx.type="String">La nostra esperienza si tramanda da generazioni, | fin dal 1924, e grazie a continui aggiornamenti siamo sempre | più specializzati nella fornitura di uffici, aziende, scuole | ed enti pubblici. Alla nostra Clientela assicuriamo un | servizio accurato e tempestivo, svolto con professionalità, | attenzione e cortesia. Venite a trovarci a Clusone, in Via | San Vincenzo de Paoli n.9, oppure contattateci telefonicamente | al numero 034623833.</sixx.object>' | | the system erase the error: | | AbstractException >> _signalFromPrimitive: (envId 0) | String >> decodeFromUTF8 (envId 0) | String class >> createInstanceOf:withSixxElement: (envId 0) | Behavior >> newInstanceFromSixxElement:context: (envId 0) | Behavior >> fromSixxElement:context: (envId 0) | Behavior >> readSixxFromSixxElement:context: (envId 0) | Behavior >> readSixxFrom:context:persistentRoot: (envId 0) | Behavior >> readSixxFrom: (envId 0) | Executed Code | String >> evaluateInContext:symbolList: (envId 0) | JadeServer >> evaluate:inContext: (envId 0) | JadeServer >> printIt:in: (envId 0) | GsNMethod class >> _gsReturnToC (envId 0) | | | | I change the String class method | | createInstanceOf: aClass withSixxElement: sixxElement | ^ (SixxXmlUtil characterDataFrom: sixxElement) decodeFromUTF8 | asString | | | removing the decodeFromUTF8. | | With this modification the system works fine but it's right | solutions? | | I need to do some change in Pharo? | | Thanks for any considerations. | | Dario | | |
Dale,
i follow your indication but when i do:
the system erase the error: AbstractException >> _signalWith: (envId 0)
AbstractException >> signal (envId 0)
SixxPortableUtil class >> signalException: (envId 0)
[] in SixxXmlUtil class >> parseXml:persistentRoot: (envId 0)
AbstractException >> _executeHandler: (envId 0)
AbstractException >> _signalWith: (envId 0)
AbstractException >> signal (envId 0)
Object >> _error:args: (envId 0)
Object >> _errorExpectedClass: (envId 0) THE ERROR where self is SmallInteger 60 and aClass is AbstractCharacter _validateClass: aClass "Returns true if self is a kind of aClass. Otherwise, generates an error." (self isKindOf: aClass) ifFalse: [
self _errorExpectedClass: aClass .
^ false
].
^ true
Object >> _validateClass: (envId 0)
String >> at:put: (envId 0)
WriteStream >> _nextPut: (envId 0)
WriteStream >> nextPut: (envId 0)
XMLTokenizer >> nextPCDataDelimitedBy:putOn: (envId 0)
[] in XMLTokenizer >> nextPCData (envId 0)
[] in XMLStreamWriter >> writeWith: (envId 0)
ExecBlock >> ensure: (envId 0)
XMLStreamWriter >> writeWith: (envId 0)
XMLTokenizer >> nextPCData (envId 0)
XMLTokenizer >> nextToken (envId 0)
SAXHandler >> parseDocument (envId 0)
XMLDOMParser >> parseDocument (envId 0)
SAXHandler class >> parseDocumentFrom:useNamespaces:persistentRoot: (envId 0)
XMLDOMParser class >> parseDocumentFrom:useNamespaces:persistentRoot: (envId 0)
SAXHandler class >> parseDocumentFrom:persistentRoot: (envId 0)
SixxYaxoXmlParserAdapter class >> parseXml:persistentRoot: (envId 0)
[] in SixxXmlUtil class >> parseXml:persistentRoot: (envId 0)
ExecBlock >> on:do: (envId 0)
SixxXmlUtil class >> parseXml:persistentRoot: (envId 0)
Behavior >> readSixxFrom:context:persistentRoot: (envId 0)
Behavior >> readSixxFrom: (envId 0)
Executed Code
String >> evaluateInContext:symbolList: (envId 0)
JadeServer >> evaluate:inContext: (envId 0)
JadeServer >> doIt:in: (envId 0)
GsNMethod class >> _gsReturnToC (envId 0) Thank for any consideration; Dario
|
Dario,
I'm sorry, you need to use: encodeAsUTF8 asString When you encodeAsUTF8 in 3.1.x, you end up with an instance of UTF8 which is a subclass of ByteArray, but the bulk of the SIXX code expects utf8 encoded data to be a String ... Dale ----- Original Message ----- | From: "Dario Trussardi" <[hidden email]> | To: "GemStone Seaside beta discussion" <[hidden email]> | Sent: Thursday, December 13, 2012 1:05:29 AM | Subject: Re: [GS/SS Beta] String UTF error from sixx string | | Dale, | | | | | | | | | Dario, | | The code that sends decodeFromUTF8 expects that the strings are | encoded in UTF8 .. in your example you are passing in an unencoded | string that contains caracters beyond the 7bitASCII range (The | encoding for 7bit ascii characters and UTF8 are identical), So your | example should work if you encode the string passed into | #readSixxFrom: in UTF8 using #encodeAsUTF8. | | | | | i follow your indication but when i do: | | | | | | Object readSixxFrom: '<sixx.object sixx.id="13" sixx.name="commento" | | sixx.type="String">La nostra esperienza si tramanda da generazioni, | | fin dal 1924, e grazie a continui aggiornamenti siamo sempre | | più specializzati nella fornitura di uffici, aziende, scuole | | ed enti pubblici. Alla nostra Clientela assicuriamo un | | servizio accurato e tempestivo, svolto con professionalità, | | attenzione e cortesia. Venite a trovarci a Clusone, in Via | | San Vincenzo de Paoli n.9, oppure contattateci telefonicamente | | al numero 034623833.</sixx.object>' encodeAsUTF8. | | the system erase the error: | | AbstractException >> _signalWith: (envId 0) AbstractException >> | signal (envId 0) SixxPortableUtil class >> signalException: (envId | 0) [] in SixxXmlUtil class >> parseXml:persistentRoot: (envId 0) | AbstractException >> _executeHandler: (envId 0) AbstractException >> | _signalWith: (envId 0) AbstractException >> signal (envId 0) Object | >> _error:args: (envId 0) Object >> _errorExpectedClass: (envId 0) | | | THE ERROR where self is SmallInteger 60 and aClass is | AbstractCharacter | _validateClass: aClass | "Returns true if self is a kind of aClass. Otherwise, generates an | error." | (self isKindOf: aClass) ifFalse: [ self _errorExpectedClass: aClass . | ^ false ]. ^ true | Object >> _validateClass: (envId 0) String >> at:put: (envId 0) | WriteStream >> _nextPut: (envId 0) WriteStream >> nextPut: (envId 0) | XMLTokenizer >> nextPCDataDelimitedBy:putOn: (envId 0) [] in | XMLTokenizer >> nextPCData (envId 0) [] in XMLStreamWriter >> | writeWith: (envId 0) ExecBlock >> ensure: (envId 0) XMLStreamWriter | >> writeWith: (envId 0) XMLTokenizer >> nextPCData (envId 0) | XMLTokenizer >> nextToken (envId 0) SAXHandler >> parseDocument | (envId 0) XMLDOMParser >> parseDocument (envId 0) SAXHandler class | >> parseDocumentFrom:useNamespaces:persistentRoot: (envId 0) | XMLDOMParser class >> | parseDocumentFrom:useNamespaces:persistentRoot: (envId 0) SAXHandler | class >> parseDocumentFrom:persistentRoot: (envId 0) | SixxYaxoXmlParserAdapter class >> parseXml:persistentRoot: (envId 0) | [] in SixxXmlUtil class >> parseXml:persistentRoot: (envId 0) | ExecBlock >> on:do: (envId 0) SixxXmlUtil class >> | parseXml:persistentRoot: (envId 0) Behavior >> | readSixxFrom:context:persistentRoot: (envId 0) Behavior >> | readSixxFrom: (envId 0) Executed Code String >> | evaluateInContext:symbolList: (envId 0) JadeServer >> | evaluate:inContext: (envId 0) JadeServer >> doIt:in: (envId 0) | GsNMethod class >> _gsReturnToC (envId 0) | | | Thank for any consideration; | | | Dario | | | | Dale | | ----- Original Message ----- | | From: "Dario Trussardi" < [hidden email] > | | To: "beta discussion Gemstone Seaside" < [hidden email] | | > | | Sent: Wednesday, December 12, 2012 7:28:14 AM | | Subject: [GS/SS Beta] String UTF error from sixx string | | | | Hi, | | | | i port some data from Pharo to GLASS with SIXX. | | | | | | Now when into GLASS i create a object with: | | | | Object readSixxFrom: '<sixx.object sixx.id="13" | | sixx.name="commento" | | sixx.type="String">La nostra esperienza si tramanda da generazioni, | | fin dal 1924, e grazie a continui aggiornamenti siamo sempre | | più specializzati nella fornitura di uffici, aziende, scuole | | ed enti pubblici. Alla nostra Clientela assicuriamo un | | servizio accurato e tempestivo, svolto con professionalità, | | attenzione e cortesia. Venite a trovarci a Clusone, in Via | | San Vincenzo de Paoli n.9, oppure contattateci telefonicamente | | al numero 034623833.</sixx.object>' | | | | the system erase the error: | | | | AbstractException >> _signalFromPrimitive: (envId 0) | | String >> decodeFromUTF8 (envId 0) | | String class >> createInstanceOf:withSixxElement: (envId 0) | | Behavior >> newInstanceFromSixxElement:context: (envId 0) | | Behavior >> fromSixxElement:context: (envId 0) | | Behavior >> readSixxFromSixxElement:context: (envId 0) | | Behavior >> readSixxFrom:context:persistentRoot: (envId 0) | | Behavior >> readSixxFrom: (envId 0) | | Executed Code | | String >> evaluateInContext:symbolList: (envId 0) | | JadeServer >> evaluate:inContext: (envId 0) | | JadeServer >> printIt:in: (envId 0) | | GsNMethod class >> _gsReturnToC (envId 0) | | | | | | | | I change the String class method | | | | createInstanceOf: aClass withSixxElement: sixxElement | | ^ (SixxXmlUtil characterDataFrom: sixxElement) decodeFromUTF8 | | asString | | | | | | removing the decodeFromUTF8. | | | | With this modification the system works fine but it's right | | solutions? | | | | I need to do some change in Pharo? | | | | Thanks for any considerations. | | | | Dario | | | | | | |
Free forum by Nabble | Edit this page |