VA 7.01, Ubuntu Linux 6.10 and CodePage Conversion

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

VA 7.01, Ubuntu Linux 6.10 and CodePage Conversion

Postby marten » Thu Jan 11, 2007 6:47 am

The following code breaks in my Ubuntu 6.10:

AbtCodePageConverter current
convert: 'Marten'
fromCodePage: 'UTF-8'
toCodePage: 'UTF-8'

Primitive failed in AbtCodePageConverter>>primOpenConvertTo:from:
due to OS error 1.

And this low level method calls Abt_Primitives:iconv_open


What is OS error 1 ????

Marten
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Postby solveig » Mon Jan 15, 2007 10:42 am

Hi, Matren,

To find out about error codes, look in error.h

Regards,
Solveig
solveig
Moderator
 
Posts: 57
Joined: Tue Oct 17, 2006 6:30 am

Postby marten » Mon Jan 15, 2007 12:46 pm

solveig wrote:Hi, Matren,

To find out about error codes, look in error.h

Regards,
Solveig


Hmm, there are no error code number definitions defined in error.h or errno.h or whatever it might be.

Actually my posting was only a hint, that there may be an error in a primitve function within the Linux version ...

I know, that Ubuntu is not supported - but it's more than difficult to get an official supported Linux operating system version for VASmalltalk - actually I would not know, where to download it from.

And it might be even more difficult to find a web hoster company supporting the last active supported Linux OS version for VASmalltalk.

Looking here in Germany around most of the hosters offer two different Linux versions for their WWW-site: SuSE and Debian.

Marten
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: VA 7.01, Ubuntu Linux 6.10 and CodePage Conversion

Postby marten » Tue Jan 16, 2007 11:16 pm

marten wrote:The following code breaks in my Ubuntu 6.10:

AbtCodePageConverter current
convert: 'Marten'
fromCodePage: 'UTF-8'
toCodePage: 'UTF-8'

Primitive failed in AbtCodePageConverter>>primOpenConvertTo:from:
due to OS error 1.


Same under OpenSuse 10.2 ....

Marten
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Postby solveig » Thu Jan 18, 2007 9:13 pm

Marten,

I was able to get a similar error on RedHat 4.3.

Since no conversion is actually needed, I changed the method to the following and got rid of the error. I have included this change in the buld for VA Smalltalk 7.5. The bold lines are the new code. See if it helps you.

Regards,
Solveig


!AbtAbstractCodePageConverter publicMethods !

convert: aStringOrByteArray fromCodePage: aSourceCodePage toCodePage: aTargetCodePage bufferSize: aCount
" Answer a new instance of the passed byte collection object which contains a code page converted version of the passed object.
aCount is the size of the target buffer to be used for the translation. "

| result1 result2 codePageConversionMessage sourceCp targetCp |
"If the code pages are the same, no conversion is required."
((aSourceCodePage notNil and: [ aSourceCodePage = aTargetCodePage ]) or: [ aStringOrByteArray isEmpty ])
ifTrue: [ ^aStringOrByteArray ].


sourceCp := aSourceCodePage isString
ifTrue: [ self class codePageFromCharacterSet: aSourceCodePage]
ifFalse: [ aSourceCodePage].
targetCp := aTargetCodePage isString
ifTrue: [ self class codePageFromCharacterSet: aTargetCodePage]
ifFalse: [ aTargetCodePage].
((sourceCp notNil and: [ sourceCp = targetCp ]) or: [ aStringOrByteArray isEmpty ])
ifTrue: [ ^aStringOrByteArray ].


" If the user has supplied a code page conversion routine, call it and answer the result "
self conversionMessage notNil
ifTrue: [ result1 := self conversionMessage abrSendWithArguments: ( Array with: aStringOrByteArray with: aSourceCodePage with: aTargetCodePage with: aCount ).
^result1 isAbtError
ifTrue: [ self error: result1 errorText ]
ifFalse: [ result1 ]].

( result1 := self
primTranslate: aStringOrByteArray
fromCodePage: aSourceCodePage
toCodePage: aTargetCodePage
bufferSize: aCount ) isAbtError
ifFalse: [ ^result1 ].

" The operating system could not perform the conversion. Use the VA string translation
support to complete the code page conversion. This method is only effective if
AbtNlsCfsSupportApp is loaded. "
^( result2 := AbtCharacterTranslator abtTranslateString: aStringOrByteArray copy fromCodePage: sourceCp toCodePage: targetCp ) isNil
ifTrue: [ self error: result1 errorText ]
ifFalse: [ result2 ]! !
solveig
Moderator
 
Posts: 57
Joined: Tue Oct 17, 2006 6:30 am

Postby marten » Fri Jan 19, 2007 12:55 am

solveig wrote:Marten,

I was able to get a similar error on RedHat 4.3.

Since no conversion is actually needed ...



Hmm, does this solve the problem ? I'm not sure about this!

"currentCodePage" returns a string named 'UTF-8' and not an integer (defining the code page). This is interesting, but might be ok.

The methods below the initial call know how to handle string-based codepage definitions, BUT they can not handle "UTF-8".

They can handle "iso8859-1" (which they convert to codepage 819), but they can not handle "iso10646-1" (which is a unicode code page). In the newer Linux/Unix fonts are also delivered with this code page.

All calls to this API, where an not usable code page is given (and UTF-8 seems to be an invalid code page definition) - brings up this primitive error.

Any ideas ????


Marten
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Postby solveig » Mon Jan 22, 2007 2:27 pm

Marten,

Do you have a test case for the failure when only one code page is utf-8? If so, please mail it to vast-support-list@instantiations.com .

We'd be happy to look at it and develop a better solution.

Regards,
Solveig
solveig
Moderator
 
Posts: 57
Joined: Tue Oct 17, 2006 6:30 am

Postby marten » Sun Feb 04, 2007 12:46 am

CodePage conversion still has problems under VA7.5 and (e.g.) OpenSuse 10.2:

AbtCodePageConverter current
convert: 'Marten'
fromCodePage: 'iso8859-1'
toCodePage: 'UTF-8'

throws a primitive failed error ...
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: VA 7.01, Ubuntu Linux 6.10 and CodePage Conversion

Postby marten » Sat Mar 17, 2007 12:43 am

marten wrote:The following code breaks in my Ubuntu 6.10:

AbtCodePageConverter current
convert: 'Marten'
fromCodePage: 'UTF-8'
toCodePage: 'UTF-8'

Primitive failed in AbtCodePageConverter>>primOpenConvertTo:from:
due to OS error 1.

And this low level method calls Abt_Primitives:iconv_open


What is OS error 1 ????

Marten


I've just read this (in the newsgroups):


A clean install of va6.0.4 on linux fails (if you load web services
features) in AbtAbstractCodePageConverter trying to translate from UTF-8 to
any other code page. It actually does this after loading the web services
feature trying to decode sstsoenc.xsd.

Interestingly if I replace the abtprc60.so library (which implements
iconv_open as part of Abt_primitives) with the abtprc60.so from a va6.0.2
install, it all seems to work fine.

Cheers,
Wayne
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: VA 7.01, Ubuntu Linux 6.10 and CodePage Conversion

Postby marten » Tue Mar 27, 2007 12:23 pm

After posting the last message here I thought I would get any response, because the error message were so similiar to my messages ... therefore I must ask again: any progress here ?

Marten
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Postby solveig » Thu Mar 29, 2007 9:19 am

Hi, Marten,

With regard to your test case,

CodePage conversion still has problems under VA7.5 and (e.g.) OpenSuse 10.2:

AbtCodePageConverter current
convert: 'Marten'
fromCodePage: 'iso8859-1'
toCodePage: 'UTF-8'

We believe that the way the OpenSuse (or the Ubuntu you reported earlier) is installed is contributing to the problem and altering the environment will recify the problem.

We are researching this and will post when we have a complete answer.

Regards,
Solveig
solveig
Moderator
 
Posts: 57
Joined: Tue Oct 17, 2006 6:30 am


Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: No registered users and 1 guest