Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to upload and download a UTF 8N file

Former Member
0 Kudos

There is no encoding option like UTF-8N in f1 help.

I have to read a UTF-8N file and should create a download in the same format.

thanks in advance.

jai

11 REPLIES 11

Sandra_Rossi
Active Contributor
0 Kudos

yes it exists. Search for code page, or encoding...

0 Kudos

this is my code::::::::::::::::::::::::::

OPEN DATASET IMP_PATHEXTERN

FOR UPDATE

MESSAGE L_MSG

IN TEXT MODE

ENCODING UTF-8

AT POSITION 3

  • CODE PAGE IMP_CPCODEPAGE

REPLACEMENT CHARACTER TEXT-002

IGNORING CONVERSION ERRORS.

How should i write code to upload a UTF-8N format file??????????help me

0 Kudos

UTF-8N is the same as UTF-8, it just indicates that there is no Byte Order Mark at the beginning of the data

0 Kudos

can u please help me with the code???

0 Kudos

UTF-8 is fine, what is the problem?

0 Kudos

For downloading in UTF-8 format i wrote the code like this...

  • UTF ------------> with BOM

CL_ABAP_FILE_UTILITIES=>CREATE_UTF8_FILE_WITH_BOM( IMP_PATHEXTERN ).

OPEN DATASET IMP_PATHEXTERN

FOR update

MESSAGE L_MSG

IN TEXT MODE

ENCODING UTF-8

at position 3

REPLACEMENT CHARACTER TEXT-002

IGNORING CONVERSION ERRORS.

then i opened the file using noeditor ..i showed me that the file is in UTF-8 format

For downloading in UTF-8N format i wrote the code like this...

*for UTF-8N

  • UTF-8N ------------> without BOM

OPEN DATASET IMP_PATHEXTERN

FOR update

MESSAGE L_MSG

IN TEXT MODE

ENCODING UTF-8

REPLACEMENT CHARACTER TEXT-002

IGNORING CONVERSION ERRORS.

but when i opened this file using noeditor it showed SHIFTJis

So i want the code to upload/download in UTF-8N format

0 Kudos

Hello Jaya,

As Sandra suggested that UTF8N is nothing but UTF8 encoding without BOM (Byte Order Mark).

So if you are using this:

CL_ABAP_FILE_UTILITIES=>CREATE_UTF8_FILE_WITH_BOM( IMP_PATHEXTERN ).

You are creating a file with UTF8 file with BOM.

It will not result in correct download in UTF-8N format .

Hope i am clear.

BR,

Suhas

0 Kudos

I know how to download in utf-8 format................

but for UTF-8N BOM should not be there.......

For downloading in UTF-8N format i wrote the code like this...

*for UTF-8N

  • UTF-8N ------------> without BOM

OPEN DATASET IMP_PATHEXTERN

FOR update

MESSAGE L_MSG

IN TEXT MODE

ENCODING UTF-8

REPLACEMENT CHARACTER TEXT-002

IGNORING CONVERSION ERRORS.

but when i opened this file using noeditor it showed SHIFTJis

So i want the code to upload/download in UTF-8N format

0 Kudos

I still have difficulties to understand where exactly you have a problem:

To create a dataset, use OPEN DATASET ... FOR OUTPUT ... ENCODING UTF-8 ... By default, there is no BOM so it corresponds to UTF-8N. If you want the BOM, add WITH BYTE-ORDER MARK.

To read the dataset, use OPEN DATASET ... FOR INPUT ... ENCODING UTF-8 SKIPPING BYTE-ORDER MARK (it works whatever there is a BOM or not, just make sure that the first 3 bytes cannot be equivalent to the UTF-8 BOM...)

If the software you use is unable to display the file correctly, try with another software. What are the steps you use to display the file from the application server? (ftp?, then which software? other?)

0 Kudos

IF I use OPEN DATASET ... FOR OUTPUT ... ENCODING UTF-8 ... THE FILE IS CREATED IN SHIFTJIS FORMAT...BUT I NEED TO

DOWNLOAD IN UTF-8N FORMAT....

0 Kudos

you really don't understand, or it's me.

What is certain is that if you write the file in UTF-8, it's UTF-8, and NOT Shift JIS.

It's the software you use to read the file that is mistaken.