Problem reading csv file with special character
Hai all,
i have the following problem reading a csv file.
442050-Operations Tilburg algemeen Huis in t Veld, EAM (Lisette) Gebruikersaccount 461041 Peildatum: 4-5-2010 AA461041 1 85,92
when reading this line with FM GUI_UPLOAD this line is split up in two lines in data_tab of the FM,
it is split up at this character
Line 1
442050-Operations Tilburg algemeen Huis in
Line 2
t Veld, EAM (Lisette) Gebruikersaccount 461041 Peildatum: 4-5-2010 AA461041 1 85,92
Anyone have a idea how to get this in one line in my interbal table??
Greetz Richard
Hi Greetz Richard
Problably character contains same binary code as line feed + carriage return.
You can use statement below as workaround.
OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING UNICODE
In this case your system must support Unicode encoding
Kind regards
Similar Messages
-
When I am uploading file with special character it gives error
Hi All,
I am uplloading one file with special character then it gives error. Please let me know solutions on this is soon as possible.
Thanks,
Madhavhi are you looking for the file to be transferred with the special character then declare it wil the char field...and send it..
or the special charactera are coming unnecessary use the command ............replace all occurances to avoid this.. -
Parsing BLOB (CSV file with special characters) into table
Hello everyone,
In my application, user uploads a CSV file (it is stored as BLOB), which is later read and parsed into table. The parsing engine is shown bellow...
The problem is, that it won't read national characters as Ö, Ü etc., they simply dissapear.
Is there any CSV parser that supports national characters? Or, said in other words - is it possible to read BLOB by characters (where characters can be Ö, Ü etc.)?
Regards,
Adam
|
| helper function for csv parsing
|
+-----------------------------------------------*/
FUNCTION hex_to_decimal(p_hex_str in varchar2) return number
--this function is based on one by Connor McDonald
--http://www.jlcomp.demon.co.uk/faq/base_convert.html
is
v_dec number;
v_hex varchar2(16) := '0123456789ABCDEF';
begin
v_dec := 0;
for indx in 1 .. length(p_hex_str) loop
v_dec := v_dec * 16 + instr(v_hex, upper(substr(p_hex_str, indx, 1))) - 1;
end loop;
return v_dec;
end hex_to_decimal;
|
| csv parsing
|
+-----------------------------------------------*/
FUNCTION parse_csv_to_imp_table(in_import_id in number) RETURN boolean IS
PRAGMA autonomous_transaction;
v_blob_data BLOB;
n_blob_len NUMBER;
v_entity_name VARCHAR2(100);
n_skip_rows INTEGER;
n_columns INTEGER;
n_col INTEGER := 0;
n_position NUMBER;
v_raw_chunk RAW(10000);
v_char CHAR(1);
c_chunk_len number := 1;
v_line VARCHAR2(32767) := NULL;
n_rows number := 0;
n_temp number;
BEGIN
-- shortened
n_blob_len := dbms_lob.getlength(v_blob_data);
n_position := 1;
-- Read and convert binary to char
WHILE (n_position <= n_blob_len) LOOP
v_raw_chunk := dbms_lob.substr(v_blob_data, c_chunk_len, n_position);
v_char := chr(hex_to_decimal(rawtohex(v_raw_chunk)));
n_temp := ascii(v_char);
n_position := n_position + c_chunk_len;
-- When a whole line is retrieved
IF v_char = CHR(10) THEN
n_rows := n_rows + 1;
if n_rows > n_skip_rows then
-- Shortened
-- Perform some action with the line (store into table etc.)
end if;
-- Clear out
v_line := NULL;
n_col := 0;
ELSIF v_char != chr(10) and v_char != chr(13) THEN
v_line := v_line || v_char;
if v_char = ';' then
n_col := n_col+1;
end if;
END IF;
END LOOP;
COMMIT;
return true;
EXCEPTION
-- some exception handling
END;Uploading CSV files into LOB columns and then reading them in PL/SQL: [It’s|http://forums.oracle.com/forums/thread.jspa?messageID=3454184�] Re: Reading a Blob (CSV file) and displaying the contents Re: Associative Array and Blob Number of rows in a clob doncha know.
Anyway, it woudl help if you gave us some basic information: database version and NLS settings would seem particularly relevant here.
Cheers, APC
blog: http://radiofreetooting.blogspot.com -
Problem import csv file with SQL*loader and control file
I have a *csv file looking like this:
E0100070;EKKJ 1X10/10 1 KV;1;2003-06-16;01C;75
E0100075;EKKJ 1X10/10 1 KV;500;2003-06-16;01C;67
E0100440;EKKJ 2X2,5/2,5 1 KV;1;2003-06-16;01C;37,2
E0100445;EKKJ 2X2,5/2,5 1 KV;500;2003-06-16;01C;33,2
E0100450;EKKJ 2X4/4 1 KV;1;2003-06-16;01C;53
E0100455;EKKJ 2X4/4 1 KV;500;2003-06-16;01C;47,1
I want to import this csv file to this table:
create table artikel (artnr varchar2(10), namn varchar2(25), fp_storlek number, datum date, mtrlid varchar2(5), pris number);
My controlfile looks like this:
LOAD DATA
INFILE 'e:\test.csv'
INSERT
INTO TABLE ARTIKEL
FIELDS TERMINATED BY ';'
TRAILING NULLCOLS
(ARTNR, NAMN, FP_STORLEK char "to_number(:fp_storlek,'99999')", DATUM date 'yyyy-mm-dd', MTRLID, pris char "to_number(:pris,'999999D99')")
I cant get sql*loader to import the last column(pris) as I want. It ignore my decimal point which in this case is "," and not "." maybe this is the problem. If the decimal point is the problem how can I get oracle to recognize "," as a decimal point??
the result from the import now, is that a decimal number (37,2) becomes 372 in the tableSet NLS_NUMERIC_CHARACTERS environment variable at OS level, before running SqlLoader :
$ cat test.csv
E0100070;EKKJ 1X10/10 1 KV;1;2003-06-16;01C;75
E0100075;EKKJ 1X10/10 1 KV;500;2003-06-16;01C;67
E0100440;EKKJ 2X2,5/2,5 1 KV;1;2003-06-16;01C;37,2
E0100445;EKKJ 2X2,5/2,5 1 KV;500;2003-06-16;01C;33,2
E0100450;EKKJ 2X4/4 1 KV;1;2003-06-16;01C;53
E0100455;EKKJ 2X4/4 1 KV;500;2003-06-16;01C;47,1
$ cat artikel.ctl
LOAD DATA
INFILE 'test.csv'
replace
INTO TABLE ARTIKEL
FIELDS TERMINATED BY ';'
TRAILING NULLCOLS
(ARTNR, NAMN, FP_STORLEK char "to_number(:fp_storlek,'99999')", DATUM date 'yyyy-mm-dd', MTRLID, pris char "to_number(:pris,'999999D99')")
$ sqlldr scott/tiger control=artikel
SQL*Loader: Release 10.1.0.3.0 - Production on Sat Nov 12 15:10:01 2005
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Commit point reached - logical record count 6
$ sqlplus scott/tiger
SQL*Plus: Release 10.1.0.3.0 - Production on Sat Nov 12 15:10:11 2005
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select * from artikel;
ARTNR NAMN FP_STORLEK DATUM MTRLI PRIS
E0100070 EKKJ 1X10/10 1 KV 1 16/06/2003 01C 75
E0100075 EKKJ 1X10/10 1 KV 500 16/06/2003 01C 67
E0100440 EKKJ 2X2,5/2,5 1 KV 1 16/06/2003 01C 372
E0100445 EKKJ 2X2,5/2,5 1 KV 500 16/06/2003 01C 332
E0100450 EKKJ 2X4/4 1 KV 1 16/06/2003 01C 53
E0100455 EKKJ 2X4/4 1 KV 500 16/06/2003 01C 471
6 rows selected.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
$ export NLS_NUMERIC_CHARACTERS=',.'
$ sqlldr scott/tiger control=artikel
SQL*Loader: Release 10.1.0.3.0 - Production on Sat Nov 12 15:10:41 2005
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Commit point reached - logical record count 6
$ sqlplus scott/tiger
SQL*Plus: Release 10.1.0.3.0 - Production on Sat Nov 12 15:10:45 2005
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select * from artikel;
ARTNR NAMN FP_STORLEK DATUM MTRLI PRIS
E0100070 EKKJ 1X10/10 1 KV 1 16/06/2003 01C 75
E0100075 EKKJ 1X10/10 1 KV 500 16/06/2003 01C 67
E0100440 EKKJ 2X2,5/2,5 1 KV 1 16/06/2003 01C 37,2
E0100445 EKKJ 2X2,5/2,5 1 KV 500 16/06/2003 01C 33,2
E0100450 EKKJ 2X4/4 1 KV 1 16/06/2003 01C 53
E0100455 EKKJ 2X4/4 1 KV 500 16/06/2003 01C 47,1
6 rows selected.
SQL> Control file is exactly as yours, I just put replace instead of insert. -
Deleting file with special character in name gets error -43
In my Trash folder there is a .html file with a name containing special characters (oriental) left over from when I uninstalled Adobe CS2. When I try to change the file name to delete the special characters so I can trash the file, I get error -43, and the name won't change. Therefore I can't get the file deleted from the computer because I can't get rid of the special characters.
Is there another way to accomplish the same thing?I presume you are referring to the notorious Vietnamese file. Others have had success getting rid of it wuth these instructions .
-
Hi All,
This perform statements then uploads the file from UNIX. Because of the special character in the file this program fails.
Please let me resulation as soon as possible .
Thanks,
MadhavHi
Good
Check the below sdn post on special character.
https://forums.sdn.sap.com/profile.jspa?userID=3649609
Thanks
mrutyun^ -
Problem to get file with special characters in the message
Hi, I'm developing an application that read the email and save the attached file. However, some files have special characters in the name, like: Documento de EspecificaÇÂO.doc
I noticed the de name of the file in de message head is:
"=?iso-8859-1?Q?Documento_de_Especifica=E7=E3o.doc?="
I'm already using the JavaMil 1.4.5
Tha is my code:
package br.com.cesan.helpdesk;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import javax.mail.Flags;
import javax.mail.Folder;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.Part;
import javax.mail.Session;
import javax.mail.Store;
import javax.mail.search.FlagTerm;
public class LerEmail2 {
* @param args
* @throws MessagingException
* @throws IOException
public static void main(String[] args) throws MessagingException, IOException {
// TODO Auto-generated method stub
// Get session
Session session = Session.getInstance(new Properties(), null);
// Get the store
Store store = session.getStore("pop3");
store.connect("pop.xxxxx.com.br", "user", "password");
Folder folder = store.getFolder("INBOX");
//folder.open(Folder.READ_ONLY);
folder.open(Folder.READ_WRITE);
// Show only unreaded Messages
FlagTerm ft = new FlagTerm(new Flags(Flags.Flag.SEEN), false);
// Get directory
Message message[] = folder.getMessages();
//Message messages[] = folder.search(ft);
for (int i=0, n=message.length; i<n; i++) {
System.out.println(i + " - "+ message.getSubject() +" - " + message[i].getSentDate() );
Object content = message[i].getContent();
if (content instanceof Multipart) {
handleMultipart((Multipart)content);
} else {
handlePart(message[i]);
// Close connection
folder.close(false);
store.close();
public static void handleMultipart(Multipart multipart) throws MessagingException, IOException {
for (int i=0, n=multipart.getCount(); i<n; i++) {
handlePart(multipart.getBodyPart(i));
public static void handlePart(Part part) throws MessagingException, IOException {
String disposition = part.getDisposition();
String contentType = part.getContentType();
if (disposition == null) { // When just body
System.out.println("Null: " + contentType);
// Check if plain
if ((contentType.length() >= 10) && (contentType.toLowerCase().substring(0, 10).equals("text/plain"))) {
part.writeTo(System.out);
} else { // Don't think this will happen
System.out.println("Other body: " + contentType);
part.writeTo(System.out);
} else if (disposition.equalsIgnoreCase(Part.ATTACHMENT)) {
System.out.println("Attachment: " + part.getFileName() + " : " + contentType);
saveFile(part.getFileName(), part.getInputStream());
} else if (disposition.equalsIgnoreCase(Part.INLINE)) {
System.out.println("Inline: " +
part.getFileName() +
" : " + contentType);
saveFile(part.getFileName(), part.getInputStream());
} else { // Should never happen
System.out.println("Other: " + disposition);
public static void saveFile(String filename, InputStream input) throws IOException {
if (filename == null) {
filename = File.createTempFile("xx", ".out").getName();
// Do no overwrite existing file
File file = new File(filename);
for (int i=0; file.exists(); i++) {
file = new File(filename+i);
System.setProperty("file.encoding", "iso-8859-1");
FileOutputStream fos = new FileOutputStream(file);
BufferedOutputStream bos = new BufferedOutputStream(fos);
BufferedInputStream bis = new BufferedInputStream(input);
int aByte;
while ((aByte = bis.read()) != -1) {
bos.write(aByte);
bos.flush();
bos.close();
bis.close();
The problem occurs in:
FileOutputStream fos = new FileOutputStream(file);
BufferedOutputStream bos = new BufferedOutputStream(fos);
BufferedInputStream bis = new BufferedInputStream(input);
int aByte;
while ((aByte = bis.read()) != -1) {
bos.write(aByte);
Thanks
Edited by: user10283976 on 30/03/2012 07:36
Edited by: user10283976 on 30/03/2012 07:37
Edited by: user10283976 on 30/03/2012 07:37
Edited by: user10283976 on 30/03/2012 07:38
Edited by: user10283976 on 30/03/2012 07:40
Edited by: user10283976 on 30/03/2012 07:41
Edited by: user10283976 on 30/03/2012 07:42http://www.oracle.com/technetwork/java/javamail/faq/index.html#encodefilename
-
Upload file with special character in ECC 6.0?
Dear All,
Does anyone know that in ECC6.0 unicode environment, can we upload special character like
eg ¢, ©, É. It's ok in 4.6c version but not in ECC 6.0. Any idea ?
ThanksHI,
Try using
open dataset <DSN> for output in legacy text mode.
and also in transfer statement pass the actual structure rather than a flat structure, while executing transfer statement for legacy mode the field lengths are taken into consideration and there is no spill over of spaces to the next field
say if you have a structure:
data: begin of wa_output,
name(20),
email(30),
end of wa_output.
and a flat structure
data: w_out(50).
then in transfer statement use wa_output rather then w_out. -
Problems reading PDF files with i Pad and Mac with 10.8.3 Mountain Lion OS
I assume InDesign uses the Acrobat XI resources to generate the exported PDFs.
I have many 1-7 page articles from which I created PDFs via the export function in ID. They all read OK on PC/Apple/Linux based computers.
I assembled all of the articles into one 50 page document in ID and again exported the large file as a PDF.
Several of the articles inside the large document now exhibit problems when viewed on an i Pad or a Mac running OS 10.8.3 (Mountain Lion). PC and Linux do not have this problem.
The problems are, to quote my subscriber: "each paragraph starts with a 'dollar' sign instead of 'Th'. Later the 'Dollar' symbol changes to ' " '. The same thing happens in the Piston Ring article. This doesn't happen on the original PDF files.
Opening the files in Acrobat Pro XI to look for differences does not discover anything although I assume the problem is somewhere in the font files.
Any suggestions?I've asked the question about the versions and producers of the PDF reader software he is using. I'll be back when that answer comes in.
I was afraid that Adobe might not use code identical to Acrobat Pro XI to generate PDFs in InDesign. I may have to 'print' to Acrobat and see if that generates a trouble-free PDF. -
Can't save file with special character
I'm trying to download a file using this
do shell script "curl -L " & DLLink & " -o " & destFile
destFile is defined with this
set destFile to POSIX path of ((choose folder) as text) & file_name as text
file_name contains "(" and ")"
AppleScript gives me this error
error "sh: -c: line 0: syntax error near unexpected token `('
Thanks in advance
Best RegardsYou could try using Applescripts 'quoted form of' and let Applescript figure it out.
ie:
do shell script "curl -L " & DLLink & " -o " & quoted form of destFile
see Technical Note TN2065, do shell script in AppleScript. -
Error opening KM file with special character
I'm using the following code to get the url to an file stored in KM, but when some file has the ( or )character in the name, an error occurs saying that the file doesn't exist in KM. The file name look like this (CDU001-C010) Delegar WorkFlow.doc.gif.
IUriReference uriRef;
IURLGeneratorService ugs;
ugs = (IURLGeneratorService) ResourceFactory.getInstance().getServiceFactory().getService(IServiceTypesConst.URLGENERATOR_SERVICE);
uriRef = ugs.getRelativeUri(PathKey.CONTENT_ACCESS_PATH).appendPath(resource.getRID().toExternalForm());
retorno = uriRef.toExternalForm();
thanks.231
-
Error opeing KM file with special character
I'm using the following code to get the url to an file stored in KM, but when some file has the [[ or ]]character in the name, an error occurs saying that the file doesn't exist in KM. The file name look like this [[CDU001-C010]] Delegar WorkFlow.doc.gif.
IUriReference uriRef;
IURLGeneratorService ugs;
ugs = (IURLGeneratorService) ResourceFactory.getInstance().getServiceFactory().getService(IServiceTypesConst.URLGENERATOR_SERVICE);
uriRef = ugs.getRelativeUri(PathKey.CONTENT_ACCESS_PATH).appendPath(resource.getRID().toExternalForm());
retorno = uriRef.toExternalForm();
thanks.
Edited by: fabio saito on May 18, 2009 6:31 PM
Edited by: fabio saito on May 18, 2009 6:32 PM
Edited by: fabio saito on May 18, 2009 6:32 PM231
-
Problem with special Character & in Proxy
Hi,
We have a File --> XI --> R/3 Scenario. In this scenario, from XI we are passing the data to R/3 by calling the Proxy. When the data in the file has special character like & (for example <Companyname>Dave&Busters</Companyname>), it is failing in R/3. But if I replace "&" with "&" in the file it works fine. Is there any solution to this problem without writting custom code in XI to replace & with &.
Thanks
Sudheer>But if I replace "&" with "&" in
> the file it works fine. Is there any solution to this
> problem without writting custom code in XI to replace
> & with &.
No. If the sender of the message provides an XML format with an unescaped &, then the XML is not valid and therefore cannot be processed.
All adapters (IDOC, RFC, File with content conversion) perform the escaping and deescaping.
Regards
Stefan -
Read Document in FileUtilities cannot search a file with french character in the file name
Hi,
I am trying to search a file with french character in the file name like 'captures écran.doc' in my unix server directory, and Write the file somewhere, say in a list of documents or, write on file system to another directory.
I am using to Read Document in FileUtilities of Foundation, but it cannot read the file due to french character in its name. Although it can find any other file name without these french characters.
Tried renaming but that also cannot find the file with french character name.
Please provide any idea to solve it using LC operation.
Regards,
Rohan Raj.Hi Thomas,
Thanks for the post, but I have already found a solution to it a month ago. Sorry for not posting the solution.
You just have to set the '-Djava.property.file.encoding=ISO8859-1' into JVM argument of your server startup, and bounce the server back to pick the new JVM arg set. And now the service Read Document in FileUtilities of Foundation will read all french characters.
ISO8859-1refers to "Latin alphabet no. 1," consisting of 191 characters from the Latin script. This character-encoding scheme is used throughout The Americas,Western Europe, Oceania, and much of Africa. It is also commonly used in most standard romanizations of East-Asian languages.
regards,
Rohan Raj. -
Reading a csv file with a large number of columns
Hello
I have been attempting to read data from large csv files with 38 columns by reading a line using readline and scanning the linebuffer using scan.
The file size can be up to 100 MB.
Scan does not seem support the large number of fields.
Any suggestions on reading the 38 comma separated fields. There is one header line in the file.
Thanks
Solved!
Go to Solution.see if strtok() is useful http://www.elook.org/programming/c/strtok.html
Maybe you are looking for
-
How to display iPad on my imac
how to display iPad on my iMac, nothing happens when I plug in iPad to charge
-
Replication of HR Bussines event groups/types to SRM
Hello, in my HR system i have Bussiness events/group hierarchy - there are some training courses....and i need to show these courses in srm cataloge, how should i do it? do i have to write a custom program? edit: i checked the note nb 312090 - there
-
Sun.nio.ch.FileDispatcher.write0 hangs
Hi, Once in a blue moon, I see my application to hang at sun.nio.ch.FileDispatcher.write0. Following is some stack dump. "Task 26941357" prio=10 tid=0x000000010327c800 nid=0x53f6 runnable [0xffffffff53a3e000..0xffffffff53a3f8a8] at sun.nio.ch.Fi
-
I posted a question a while ago about running virtual servers on OS X/XServe. It'd be pretty spiffy to keep a little Linux/BSD/Windows server running in a sandbox environment, particularly considering how powerful the XServe hardware is. Of course, w
-
Cannot re-load photos into iPhoto after moving to external
HELP! I have over 3,000 photos and had to move them to an external drive as my computer ran out of space. Now that I have moved everything, I am having a hard time accessing my photos in iPhoto. Anytime I try to import I receive the following message