FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ICU 3.6?

 
Post new topic   Reply to topic     Forum Index -> Mango
View previous topic :: View next topic  
Author Message
keinfarbton



Joined: 03 Dec 2005
Posts: 224
Location: Stuttgart - Germany

PostPosted: Thu Nov 01, 2007 5:53 pm    Post subject: ICU 3.6? Reply with quote

I try to convert from ISO-8859-15 to Utf8 with ICU. On my Ubuntu only ICU 3.6 is available, but this icu wrapper was written for 3.0/3.2. After changing ICU.d to load version 3.6 it links but I get a runtime exception. Is this because of I do not use the lib correctly or is it a problem that my version 3.6 is not completely compatible?

The code I tried:
Code:

module t;
import mango.icu.UConverter;
import tango.io.FileConduit;
import tango.io.Stdout;

int main( char[][] args ){

    auto cv = new UConverter( "ISO-8859-15" );
    auto utfcv = new UConverter( "utf8" );

    // transcoder mit source.createTrancoder( destination )
    auto tc = cv.createTranscoder( utfcv );

    ubyte[] ibuf = new ubyte[1024];
    char[]  obuf = new char[ ibuf.length * 4 ]; // absolute maximum
    auto icond = new FileConduit( args[1] );
    auto ocond = new FileConduit( args[2], FileConduit.WriteCreate );

    UAdjust adj;
    int isz;
    while( (isz = icond.read( ibuf )) > 0 ){
        tc.convert( ibuf[0..isz], obuf, adj, false ); // exception here
        ocond.write( obuf[0..adj.output]);
    }
    tc.convert( null, obuf, adj, true );
    ocond.write( obuf[0..adj.output]);
    ocond.close;

    return 0;

}


The internal returned error code of ucnv_convertEx is 1==U_ILLEGAL_ARGUMENT_ERROR (see unicode/utypes.h)

The exception occurs on the first call, even if the input does only contain ascii chars
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Sat Nov 03, 2007 2:07 am    Post subject: Reply with quote

Looks ok, Frank. I wonder if the API has changed? What does that error mean in this context?
Back to top
View user's profile Send private message
keinfarbton



Joined: 03 Dec 2005
Posts: 224
Location: Stuttgart - Germany

PostPosted: Sun Nov 04, 2007 9:04 am    Post subject: Reply with quote

In the header the function "ucnv_convertEx" is marked:
Code:
@stable ICU 2.6

Quote:
What does that error mean in this context?

I inserted a printf in the ICU.d testError function. So I know it is the error code 1 from ucnv_convertEx that causes the exception.
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Sun Nov 04, 2007 12:30 pm    Post subject: Reply with quote

but what does error-code 1 mean?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Mango All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group