Nicolas Cellier uploaded a new version of Multilingual to project The Trunk:
http://source.squeak.org/trunk/Multilingual-nice.160.mcz ==================== Summary ==================== Name: Multilingual-nice.160 Author: nice Time: 23 May 2013, 10:56:03.76 pm UUID: 8b1dfd64-8d3c-414d-9431-8a6c93a02b26 Ancestors: Multilingual-tpr.159 Let MC encode source in UTF-8 STEP 1: create an InvalidUTF8 Error which we can later recover from for handling legacy non UTF-8 source =============== Diff against Multilingual-tpr.159 =============== Item was added: + Error subclass: #InvalidUTF8 + instanceVariableNames: 'string' + classVariableNames: '' + poolDictionaries: '' + category: 'Multilingual-TextConversion'! + + !InvalidUTF8 commentStamp: 'nice 5/23/2013 22:43' prior: 0! + An InvalidUTF8 is an Exception that is raised when attempting to decode an invalid UTF-8 Sequence + + Instance Variables + string: <String> + + string + - the string that were decoded + ! Item was added: + ----- Method: InvalidUTF8>>isResumable (in category 'private') ----- + isResumable + ^true! Item was added: + ----- Method: InvalidUTF8>>messageText (in category 'private') ----- + messageText + "Return a textual description of the exception." + ^messageText ifNil: [string + ifNil: ['Invalid UTF8'] + ifNotNil: ['Invalid utf8: ', string]]! Item was added: + ----- Method: InvalidUTF8>>string: (in category 'private') ----- + string: aString + string := aString! Item was changed: ----- Method: UTF8TextConverter class>>errorMalformedInput: (in category 'utilities') ----- errorMalformedInput: aString "Invalid UTF-8 input has been detected in the given string. Raise an error if strict conversions are enabled, otherwise allow the original string to be returned." self strictUtf8Conversions ifTrue:[ + (InvalidUTF8 new string: aString) signal. - self error: 'Invalid utf8: ', aString ]. ^aString! |
This rather was for inbox, but it should be both harmless and useful in trunk 2013/5/23 <[hidden email]> Nicolas Cellier uploaded a new version of Multilingual to project The Trunk: |
I'm ok with that!
frank On 23 May 2013 22:01, Nicolas Cellier <[hidden email]> wrote: > This rather was for inbox, but it should be both harmless and useful in > trunk > > > 2013/5/23 <[hidden email]> > >> Nicolas Cellier uploaded a new version of Multilingual to project The >> Trunk: >> http://source.squeak.org/trunk/Multilingual-nice.160.mcz >> >> ==================== Summary ==================== >> >> Name: Multilingual-nice.160 >> Author: nice >> Time: 23 May 2013, 10:56:03.76 pm >> UUID: 8b1dfd64-8d3c-414d-9431-8a6c93a02b26 >> Ancestors: Multilingual-tpr.159 >> >> Let MC encode source in UTF-8 >> STEP 1: create an InvalidUTF8 Error which we can later recover from for >> handling legacy non UTF-8 source >> >> =============== Diff against Multilingual-tpr.159 =============== >> >> Item was added: >> + Error subclass: #InvalidUTF8 >> + instanceVariableNames: 'string' >> + classVariableNames: '' >> + poolDictionaries: '' >> + category: 'Multilingual-TextConversion'! >> + >> + !InvalidUTF8 commentStamp: 'nice 5/23/2013 22:43' prior: 0! >> + An InvalidUTF8 is an Exception that is raised when attempting to decode >> an invalid UTF-8 Sequence >> + >> + Instance Variables >> + string: <String> >> + >> + string >> + - the string that were decoded >> + ! >> >> Item was added: >> + ----- Method: InvalidUTF8>>isResumable (in category 'private') ----- >> + isResumable >> + ^true! >> >> Item was added: >> + ----- Method: InvalidUTF8>>messageText (in category 'private') ----- >> + messageText >> + "Return a textual description of the exception." >> + ^messageText ifNil: [string >> + ifNil: ['Invalid UTF8'] >> + ifNotNil: ['Invalid utf8: ', string]]! >> >> Item was added: >> + ----- Method: InvalidUTF8>>string: (in category 'private') ----- >> + string: aString >> + string := aString! >> >> Item was changed: >> ----- Method: UTF8TextConverter class>>errorMalformedInput: (in category >> 'utilities') ----- >> errorMalformedInput: aString >> "Invalid UTF-8 input has been detected in the given string. >> Raise an error if strict conversions are enabled, otherwise allow >> the original string to be returned." >> >> self strictUtf8Conversions ifTrue:[ >> + (InvalidUTF8 new string: aString) signal. >> - self error: 'Invalid utf8: ', aString >> ]. >> >> ^aString! >> >> > > > > |
In reply to this post by commits-2
On Thu, 23 May 2013, [hidden email] wrote:
> Nicolas Cellier uploaded a new version of Multilingual to project The Trunk: > http://source.squeak.org/trunk/Multilingual-nice.160.mcz > > ----- Method: UTF8TextConverter class>>errorMalformedInput: (in category 'utilities') ----- > errorMalformedInput: aString > "Invalid UTF-8 input has been detected in the given string. > Raise an error if strict conversions are enabled, otherwise allow > the original string to be returned." > > self strictUtf8Conversions ifTrue:[ > + (InvalidUTF8 new string: aString) signal. I think using cascade is better in this case: InvalidUTF8 new string: aString; signal Levente > - self error: 'Invalid utf8: ', aString > ]. > > ^aString! > > > |
Maybe... Except my lazyness, even better would have been a class side 'instance creation' method, which is what the construct suggests.
2013/5/24 Levente Uzonyi <[hidden email]>
|
Free forum by Nabble | Edit this page |