Forums

Find answers, ask questions, and connect with our
community all around the world.

Home Forum Omnis General Forum Import data encoding App Web

  • Import data encoding App Web

    Posted by Coralie on September 17, 2019 at 3:36 pm

    Hi everyone,
    I need help regarding an import method for a web application.
    Right now, the method works but only for one type of encoding :
    //For UTF-8 encoding type:
    Do iJSFileRow.$loadcols()
    Do iJSMimeList.$search(low(iJSMimeList.name)=’content-disposition’;kTrue;kFalse;kFalse;kFalse)
    Do iJSFileMimeList.$line.$assign(1)
    Calculate iFileName as iJSMimeList.value
    Do utf8tochar(tJSFileBinData) Returns iImport
    ————————–
    //For ANSI encoding type:
    Do iJSFileRow.$loadcols()
    Do iJSMimeList.$search(low(iJSMimeList.name)=’content-disposition’;kTrue;kFalse;kFalse;kFalse)
    Do iJSFileMimeList.$line.$assign(1)
    Calculate iFileName as iJSMimeList.value
    Do uniconv(kUniTypeAnsiLatin1;tJSFileBinData;kUniTypeUTF8;iImportNat;kTrue;errtext()) Returns #F
    Do utf8tochar(iImportNat) Returns iImport
    The thing is, I have to make it possible for the user to import a file, regardless of its encoding type (most likely either UTF-8 or ANSI).
    Does someone has an idea on how to do it or do I have to add a checkbox for the user to declare the encoding of his file?
    Regards,
    Coralie.

    Coralie replied 4 years, 6 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

Log in to reply.