Output chinese character to CSV file in UNIX
Hi
I encountered ABAP dump whenever output chinese character to CSV file in UNIX in ECC6. Error show as
"At the conversion of a text from codepage '4102' to codepage '1100':
- a character was found that cannot be displayed in one of the two
codepages;
- or it was detected that this conversion is not supported"
The program with coding of statement OPEN DATASET xxxxx FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE. Reason to output to OPEN statement to non-unicode as users would like to open the csv file thru Excel directly. They do not wish to open the text file in Excel. Can Experts please share with me how to overcome the problem?
Thanks
Kang Ring
May be you could give a try with the following code and check
OPEN DATASET xxxxx FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE CODEPAGE '4103'.
Vikranth
Similar Messages
-
How to asssign output value in the CSV file for the specific header
Hi,
I am using OpenScript 9.10. The problem I am facing is that, to Write the Output value captured from the application, When i am trying to use the methods "Appen String to File" i am unable to write / assign the out put value below the specific header. Can any one please look into this and post the methods related to Write the output vaues in to the CSV files under specific headers.
Thanks in Advance.
Thanks.,
SivaHi Alex,
Thanks for your reply.I need to write the output value under specified parameter name.
for example after creating the sales order,the order number have to write in the CSV file under
OrderNumber column.I tried with appendStringtofille() method,by using this able to write the value under
first column.But i need to write output value under specified columnname(means Header name in the cSV
file).can u please give a reply for the above problem.
Note: In that Csv file i am taking the input vales and also need to write the output values under
specified column(header)
Thanks,
Siva Thota. -
How to call a SP with dynamic columns and output results into a .csv file via SSIS
hi Folks, I have a challenging question here. I've created a SP called dbo.ResultsWithDynamicColumns and take one parameter of CONVERT(DATE,GETDATE()), the uniqueness of this SP is that the result does not have fixed columns as it's based on sales from previous
days. For example, Previous day, customers have purchased 20 products but today , 30 products have been purchased.
Right now, on SSMS, I am able to execute this SP when supplying a parameter. What I want to achieve here is to automate this process and send the result as a .csv file and SFTP to a server.
SFTP part is kinda easy as I can call WinSCP with proper script to handle it. How to export the result of a dynamic SP to a .CSV file?
I've tried
EXEC xp_cmdshell ' BCP " EXEC xxxx.[dbo].[ResultsWithDynamicColumns ] @dateFrom = ''2014-01-21''" queryout "c:\path\xxxx.dat" -T -c'
SSMS gives the following error as Error = [Microsoft][SQL Server Native Client 10.0]BCP host-files must contain at least one column
any ideas?
thanks
Hui
--Currently using Reporting Service 2000; Visual Studio .NET 2003; Visual Source Safe SSIS 2008 SSAS 2008, SVN --Hey Jakub, thanks and I did see the #temp table issue in our 2008R2. I finally figured it out in a different way... I manage to modify this dynamic SP to output results into
a physical table. This table will be dropped and recreated everytime when SP gets executed... After that, I used a SSIS pkg to output this table
to a file destination which is .csv.
The downside is that if this table structure ever gets changed, this SSIS pkg will fail or not fully reflecting the whole table. However, this won't happen often
and I can live with that at this moment.
Thanks
--Currently using Reporting Service 2000; Visual Studio .NET 2003; Visual Source Safe SSIS 2008 SSAS 2008, SVN -- -
How to put Chinese character in jar file by java.util.jar.Manifest?
Now I want to develop a simple package tool which can modify some property in manifest.mf of jar files,but the Manifest class's putValue method only can correctly save English character.why?
And how can I put Chinese character?
the code is:
Attributes ab = mf.getMainAttributes();
ab.putValue("agent-Name", agent);Attribute values can contain any character and it will be UTF-8 encoded when written to the manifest, according to Javadoc.
What makes you think that this mechanism fails? What do you see instead of the Chinese character? And what tool/editor/program you use to see it? I did not try myself, but according to the Javadoc there should be no problem. -
Csv upload -- suggestion needed with non-English character in csv file
<p>Hi All,</p>
I have a process which uploads a csv file into a table. It works with the normal english characters. In case of non-English characters in the csv file it doesn't populate the actual columns.
My csv file content is
<p></p>First Name | Middle Name | Last Name
<p><span style="background-color: #FF0000">José</span> | # | Reema</p>
<p>Sam | # | Peter</p>
<p>Out put is coming like : (the last name is coming as blank )</p>
First Name | Middle Name | Last Name
<p><span style="background-color: #FF0000">Jos鬣</span> | Reema | <span style="background-color: #FF0000"> blank </span></p>
<p>Sam | # | Peter</p>
http://apex.oracle.com/pls/otn/f?p=53121:1
workspace- gil_dev
user- apex
password- apex12
Thanks for your help.
ManishManish,
PROCEDURE csv_to_array (
-- Utility to take a CSV string, parse it into a PL/SQL table
-- Note that it takes care of some elements optionally enclosed
-- by double-quotes.
p_csv_string IN VARCHAR2,
p_array OUT wwv_flow_global.vc_arr2,
p_separator IN VARCHAR2 := ';'
IS
l_start_separator PLS_INTEGER := 0;
l_stop_separator PLS_INTEGER := 0;
l_length PLS_INTEGER := 0;
l_idx BINARY_INTEGER := 0;
l_quote_enclosed BOOLEAN := FALSE;
l_offset PLS_INTEGER := 1;
BEGIN
l_length := NVL (LENGTH (p_csv_string), 0);
IF (l_length <= 0)
THEN
RETURN;
END IF;
LOOP
l_idx := l_idx + 1;
l_quote_enclosed := FALSE;
IF SUBSTR (p_csv_string, l_start_separator + 1, 1) = '"'
THEN
l_quote_enclosed := TRUE;
l_offset := 2;
l_stop_separator :=
INSTR (p_csv_string, '"', l_start_separator + l_offset, 1);
ELSE
l_offset := 1;
l_stop_separator :=
INSTR (p_csv_string,
p_separator,
l_start_separator + l_offset,
1
END IF;
IF l_stop_separator = 0
THEN
l_stop_separator := l_length + 1;
END IF;
p_array (l_idx) :=
(SUBSTR (p_csv_string,
l_start_separator + l_offset,
(l_stop_separator - l_start_separator - l_offset
EXIT WHEN l_stop_separator >= l_length;
IF l_quote_enclosed
THEN
l_stop_separator := l_stop_separator + 1;
END IF;
l_start_separator := l_stop_separator;
END LOOP;
END csv_to_array;and
PROCEDURE get_records (p_clob IN CLOB, p_records OUT varchar2_t)
IS
l_record_separator VARCHAR2 (2) := CHR (13) || CHR (10);
l_last INTEGER;
l_current INTEGER;
BEGIN
-- SIf HTMLDB has generated the file,
-- it will be a Unix text file. If user has manually created the file, it
-- will have DOS newlines.
-- If the file has a DOS newline (cr+lf), use that
-- If the file does not have a DOS newline, use a Unix newline (lf)
IF (NVL (DBMS_LOB.INSTR (p_clob, l_record_separator, 1, 1), 0) = 0)
THEN
l_record_separator := CHR (10);
END IF;
l_last := 1;
LOOP
l_current := DBMS_LOB.INSTR (p_clob, l_record_separator, l_last, 1);
EXIT WHEN (NVL (l_current, 0) = 0);
p_records (p_records.COUNT + 1) :=
REPLACE (DBMS_LOB.SUBSTR (p_clob, l_current - l_last, l_last),
l_last := l_current + LENGTH (l_record_separator);
END LOOP;
END get_records;Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://htmldb.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Unable to output data to a csv file
hi,
i need to out put some values to a csv file (the one that is mapped to it in the databank). i have used the function
rswapp.setdatabankvalue "name", value
where name is the variable name that is mapped to the field that should be updated by the script and value contain a string value that i want to export...
somehow this code is not working properly.... :(
can someone help me.......
thanks in advanceHi Priyanshu,
The function setDatabankValue will not write to the .csv file, but it will override the current databank. This would be useful if you had a function in VBA that you would like to use to replace a Databanked parameter. In order to output to the csv you will need to use file i/o functions.
From online help the code below is the basic syntax where "newline" is what is going to be placed in test.txt
newline would be replaced by the new variable that you want to output. Also, be sure that you reference EmpirixUtilities in your VBA. Hope this helps.
Jim
Private Sub RSWVBAPage_beforePlay()
Dim m_util As EmpirixUtilities.FileIO
Set m_util = New EmpirixUtilities.FileIO
Dim resultb As Boolean
Dim mstatus As String
'write a line
resultb = m_util.WriteToFile("c:\Test.txt", "newlineText", Append, mstatus)
Call RSWApp.WriteToLog(CStr(resultb), "", mstatus)
Set m_util = Nothing
End Sub -
Writing chinese character into a file
Hi,
I need to write chinese characters into a file,I used FileOutputStream, using the method write(byte[] b)...
whereby I will convert the chinese word into bytes....
but it couldn't work...
Please Help!!you can write the unicode hex string (e.g. 606D559C53D18D22 for Gong Xi Fa Chai) into a text file by using the following code
PrintWriter out2 = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream("chinese_out.txt", false), "UTF-8")));
int countChineseChar = chineseHex.length()/4;
int index = 0;
String c = "";
int b;
for(int i=0; i<countChineseChar-1; i++)
c = new String(chineseHex.substring(index, index+4));
b = Integer.parseInt(c, 16);
out2.write(b);
index+=4;
Note that the OutputStreamWriter uses the UTF-8 to encode the unicode hex. I'm assuming that the hex is fixed at 4 digits each character
syam -
Output SELECT statement to CSV file
Can someone advise the best approach please
I'm trying to create a CSV file from the output of a SELECT statement in ApEx as a PL/SQL block. I initially thought the simplest approach would be to use SPOOL and then execute the SELECT startment but I think this is a SQLPlus command and can't be used in PL/SQL.
I then tried using the 'UTL_FILE.PUT' command which works for a single record but I'm not sure how to implement this where the SELECT returns multiple records.
DECLARE
fHandler UTL_FILE.FILE_TYPE;
v_DAT VARCHAR(20);
v_Handle VARCHAR2(20);
BEGIN
SELECT DATA INTO v_DAT FROM HIP_TEST;
v_Handle := CONCAT('HIP_',CONCAT(TO_CHAR(sysdate,'yyyymmddhhmi'),'.csv'));
fHandler := UTL_FILE.FOPEN('/nfsacademy/amp/live', v_Handle, 'w');
UTL_FILE.PUTF(fHandler, v_DAT);
UTL_FILE.FCLOSE(fHandler);
EXCEPTION
WHEN utl_file.invalid_path THEN
raise_application_error(-20000, 'Invalid path. Create directory or set UTL_FILE_DIR.');
END;Hi,
You can try this.
DECLARE
fHandler UTL_FILE.FILE_TYPE;
v_DAT VARCHAR(20);
v_Handle VARCHAR2(20);
BEGIN
v_Handle := CONCAT('HIP_',CONCAT(TO_CHAR(sysdate,'yyyymmddhhmi'),'.csv'));
fHandler := UTL_FILE.FOPEN('/nfsacademy/amp/live', v_Handle, 'w');
FOR I IN (SELECT DATA FROM HIP_TEST)
LOOP
UTL_FILE.PUTF(fHandler, i.data);
END LOOP;
UTL_FILE.FCLOSE(fHandler);
EXCEPTION
WHEN utl_file.invalid_path THEN
raise_application_error(-20000, 'Invalid path. Create directory or set UTL_FILE_DIR.');
END;** NOT TESTED **
Alternatively you can also use DBMS_OUTPUT.PUT_LINE.
Regards,
Avinash
Edited by: Avinash Tripathi on Nov 17, 2009 3:35 PM -
How does TestStand interpret the /T character in csv file
I have the following entry in a TestStand 4.0.1 csv file. PET_PAELOG_Path,C:\Program Files\TrippLite\PowerAlert\data\paelog.txt
The \T is being interpreted as a tab character when read in with a property loader step type. The file format is set to "Comma Delimited Text (.csv).
Should this be happening?Hi,
Yes, you need to double up the \ character.
Regards
Ray Farmer
Regards
Ray Farmer -
Export arabic character into csv file turns into question mark in sql dev
Hi,
I am trying to export a table's output that contains some arabic and english mixed data, when I try to export it in csv, all the arabic characters change into question mark (?) but the same export is working fine on .xls or .xlsx.
Since we have to export a huge data and csv is much faster thar .xls, kindly let me know why it is happening and what is the solution for this.
Well, we are on Oracle 11gR2 and Sql Dev is 3.1
Appreciate your time and experience sharing.
Regards.Hi,
Since you say it works for xls but not csv, and the only applicable preference setting ( Tools|Preferences|Database|Utilities|Export|Encoding ) should apply to all export formats, I would imagine this is a bug. Especially if the encoding specified in Preferences is consistent with the client OS settings. I was not able to find any prior bug logged against the Export utility for this issue.
I logged a bug for this:
Bug 13993410 - FORUM: ARABIC CHARACTER ENCODING RESPECTED FOR XLS BUT NOT CSV
Regards,
Gary
SQL Developer Team -
How to read text file contain chinese character ?
Hi XI Expert,
I have scenario to read text file contain Chinese Character using sender file adapter. but every i was check from sxmb_moni all the chinese character looks different. and also the target file also i has changes.
Please advise me how to maintaine the chinese character in PI 7.0 SP17.
Thank You and Best Regards
FernandHi,
Refer these threads..
Receiver file adapter corrupting characters
Problem in converting special characters in input text file
Here is one more useful guide..
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42
Regards,
Sarvesh
Edited by: Sarvesh Singh on Nov 17, 2008 3:47 PM -
Convert chinese character to unicode
hello,i have a problem.
how can i know the unicode of chinese character in a file?
like this character ' 称 ' in a file a.txt
then how can i do to read the a.txt file then get the unicode of the character?
really need help..i want to know what is the algorithm and the coding
of that tool.
thanksYou might consider downloading the open source project and looking directly at the code for that tool. I imagine that you could create something similar in...oh, maybe 25 lines of code.
retrieve the command line args
open the specified file using the charset encoding specified
for (all characters in the file) {
if character is > 0xFF convert to \uXXXX
output character to new file
John O'Conner -
Hi,
I want to spool a csv file from unix.. I have a shell script where im calling the .sql file in returns it select the data from the table and spool it to CSV..
THe problem i have here when i spool it , it is not comming in the right format..
for ex :
set head on;
set feed off;
set trimspool on;
set linesize 32627;
set pagesize 32627;
set echo off;
set termout on;
O/p is like
empid ename sal mgr
1234 xysss 2323232 wewew
Can anyone please help me out...Hi,
When posting formatted text (such as your output) on this site, type these 6 characters:
\(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
What's wrong with the current output?
What is the correct output you want?
A lot of folks concatenate all their output into one big string column for CSV output.
That is, instead of:SELECT empid
, ename
, hiredate
, sal
they say:SELECT empid
|| ',' || ename
|| ',' || TO_CHAR (hiredate, 'DD-MON-YYYY')
|| ',' || sal
Most of the time, NUMBER columns don't require special formatting, but DATEs often do. -
GUI Download Chinese Character to Excel gibberish character
Hi Experts,
I'm facing a problem where I'm using FM gui_download to save Chinese Character into Excel file.
Upon double click to open the excel file, funny character shows up.
But if I were to open the same file using a blank Ms Excel application (Go to File->Open->choose file),
Excel will prompt me to select a proper encoding (GB2312 in this case), and the Chinese character can be seen thereafter.
But, my user doesn't want to go through this.
I've browsed through the forum and someone has posted about this before and it's unanswered.
How to download the chinese character using GUI_DOWNLOAD - unanswered
And, Re: GUI_DOWNLOAD give 2 bytes for each chinese character - I need fixed len which is not related to my problem.
Below is my code:
DATA: lv_codepage TYPE cpcodepage,
lv_char_cpage TYPE abap_encod,
lv_encoding TYPE abap_encod.
Get Code Page for Chinese Character Spras = '1' or 'ZH'
CALL FUNCTION 'NLS_GET_FRONTEND_CP'
EXPORTING
langu = '1' " Chinese Simplified Table T002
fetype = 'MS' " Manufacturer is Microsoft Table TCP05
IMPORTING
frontend_codepage = lv_codepage
EXCEPTIONS
illegal_syst_codepage = 1
no_frontend_cp_found = 2
internal_or_db_error = 3
OTHERS = 4.
Conversion c(4) = n(10)
lv_char_cpage = lv_codepage.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = p_file
filetype = 'DAT' "tried ASC and not working as well
codepage = lv_char_cpage "8404 in this case tried 8400 and same result
replacement = '#'
write_field_separator = 'X'
TABLES
data_tab = i_data_cnvr "table content
fieldnames = i_data_head "table header
Please help. Does this has something to do with utf-8 encoding?
Thank you.
Thanks,
ZY SeeHi Nitesh,
Is there a way to check the Excel codepage? Do you mean by codepage = 936 for GB2312 encoding?
Anyway, this issue is fixed. Issue is related to unicode system.
Below codes for gui_download solved the problem.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
codepage = '4103'
replacement = '#'
write_field_separator = 'X'
write_bom = 'X'
TABLES
data_tab = i_data_cnvr
fieldnames = i_data_head
Codepage = 4103 for utf-16 Unicode system.
Write-bom = 'X' to write Byte-Order-Mark.
Thanks,
ZY See -
Hi Experts
I have one UNIX server and i my user is putting the csv files on windows machine. I want
1. If User put some new csv file in windows machine it should automatically reflect in UNIX machine.
2. If user enter some data in windows csv files then it should be reflect in UNIX csv files automatically
3. Now I want to connect my OWB with these UNIX csv fils. my csv files are in /home/oracle.source directory.
Regards
FrndLet me give an insight of how it works for me:
1. A CSV file is created in unix at a specified location.
2. Using ULTRAEDIT software(installed on windows client) FTP is configured to access the unix server.
3. Open the file stored in unix through ULTRAEDIT from windows.
4. MAKE changes to the file from ultraedit in windows.
5. SAVE it and close ULTRAEDIT.
The changes will be automatically reflected in unix without having the need to FTP it.
OWB accesses the CSV file from unix and does further processing.
Not sure if OPs can do this but this is probably the easiest way of achieving what he wants and this approach works very well for me.
Maybe you are looking for
-
Itunes wont open, not a quicktime problem
i have looked everywhere, tried everything. My quicktime will open but my itunes wont. i click it and my curser stalls like it is about to open but never does. sometimes that white agreement box flashes but goes away without a chance to read or click
-
Help me! I want to buy songs on iTunes, but it won't let me! Is there a way I can let iTunes know that I use Google Chrome? Or do I just have to spend a lot of money on buying another version of Mac OS X?
-
How do I get the messages on my macbook to send from my phone number
I have been using my macbook pro for iMessage for at least a year. Yesterday I reset the password because I received a notification that there had been a log in to my iCloud from an outside source. Today I am messaging and the person receiving the iM
-
BB device deleting calendar entries dispite "Keep Forever" setting on
OK, here's my plight. I am using the latest o/s on my phones (Storm 9530 and a World Edition loaner, each of which exhibit the same problem) and Desktop Manager 5.0.1. I only perform "wired" syncs using the USB cord (I am NOT syncing wirelessly and
-
How to use same collection type in different database
i have created a synonym for a package whcih uses a collection type as input and when i am calling through that synonym it is throwing an error b'coz of the collection type saying wrong no. of arguements... declare collection_type collection_type:=co