Hi all !! I have just created a tool for our compa...
# suitescript
j
Hi all !! I have just created a tool for our company to do massive creation via csv of item receipts, or whatever we want to create massive, (even many steps as Item->Purchase->Receipt->Bill). It Works very simple, on a suitelet we receive a csv file and a restlet verifys if is a normal custimport or we should run a code on a Map/reduce Script. The problem we are facing is that for example: "Acción" or "intenção" that has special UTF-8 characters, when the suitelet reads the csv, characters are changed by [?]. Does any one has experienced this before? This is the code that reads csv content:
Copy code
function process_post(context) {
            try {
                var upload_field = context.request.files.custpage_kc_select_file;
                var body = ''
                var iterator = upload_field
                    .lines
                    .iterator();


                iterator.each(function (line) {
                    body += line.value + '\n'
                    return true;
                });
                var base64EncodedString = encode.convert({
                    string: body,
                    inputEncoding: encode.Encoding.UTF_8,
                    outputEncoding: encode.Encoding.BASE_64
                });
                var ImportInfo = getImport(context.request.parameters.custpage_kc_csv_permission_names);

                var requestBody = {
                    record_id: context.request.parameters.custpage_kc_csv_permission_names,
                    csv_import_id: ImportInfo.custrecord_kc_csv_permission_script_id,
                    user_id: userObj.id,
                    data: base64EncodedString,
                    delimiter:ImportInfo.custrecord_kc_csv_permission_delimiter,
                    type: (ImportInfo.custrecord_kc_csv_permission_script_id).split('_')[0]
                };

                return requestRestlet(requestBody);
            } catch (error) {
                log.debug("Error process_post", JSON.stringify(error));
                return error;
            }


        }
b
are you sure your input file is utf-8?
j
Yes, i change the encoding when excel file is saved
b
that sounds a little unsure
make a file with only Acción in it
upload it here