[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: conversion error



Hi Scott
thank you for your answer, in meantime I solved the problem because on the web I found and read your very interesting article about "Character set translation with the Open() API" and so I realize the problem was that I use codepage instead of ccsid.
best   regards
Mario

-----Messaggio originale----- From: Scott Klement
Sent: Friday, December 13, 2013 5:53 AM
To: HTTPAPI and FTPAPI Projects
Subject: Re: conversion error

Mario,

You are specifying O_CODEPAGE on your call to open().   CCSID 1208 is a
CCSID, not a code page!!   Use O_CCSID instead of O_CODEPAGE.

-SK


On 11/19/2013 8:30 AM, Mario Martoriello wrote:
    Hi all
I am using httpapi to send a xml file to a webserver. Everything worked
    fine until I need to create a file in UTF-8. I modified my program as
    follow :
    // delete the file if exists
    If unlink(nomefile) < 0
    ;
       err = errno
    ;

       if err <> ENOENT
    ;
         callp die('unlink(): ' + %str(strerror(err)))
    ;
       EndIf
    ;

    Endif
    ;

    // ** Create a new file with CCSID 1208 for
    utf-8
    //     fd = open(nomefile:O_CREAT+O_WRONLY+O_CODEPAGE:        <---
    before  when it was not necessary in UTF I used codepage and it
    worked
    //                    S_IRWXU+S_IRWXG+S_IRWXO:850)
    ;
    fd = open(nomefile:O_CREAT+O_WRONLY+O_CCSID
    :
                        S_IRWXU+S_IRWXG+S_IRWXO:1208)
    ;
    If fd < 0
    ;

        callp die('open(): ' + %str(strerror(errno)))
    ;
    EndIf
    ;

    callp close(fd)
    ;

    // Open the file again. Since the file already exists and has a CCSID,
    we can enable translation
    fd = open(nomefile:O_WRONLY+O_TEXTDATA)
    ;
    if fd < 0
    ;

       callp die('2 open(): ' + %str(strerror(errno)))  ;
    endif  ;

    On the second open I receive an error : Conversion error
    Can anyone tell me what is wrong?
    thanks in advance
    Mario



-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------







-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------