on 2013 Nov 25 2:08 PM
I am trying to select just the value from a table on SQL Anywhere 12.0.1 and keep getting strange characters in the first columns of the output file:
Example command:
dbisql @dbadmin_dbn -nogui "unload select VolumeName from backupvols where BackupScheduleID = ${BKPSET} to '${MASTERLOG}' FORMAT ascii delimited by ' '"
Example output:
$ cat /tmp/nvitpcmnf550_11_25_2013_13.04.16_log 'eac_dv_sybsft1_01' 'eac_dv_sybbkp_01'
How do I get rid of these odd characters ?
Request clarification before answering.
From: http://en.wikipedia.org/wiki/Byte_order_mark (BOM)
The UTF-8 representation of the BOM is the byte sequence 0xEF,0xBB,0xBF. A text editor or web browser interpreting the text as ISO-8859-1 or CP1252 will display the characters

for this.
Meaning that your source data is UTF-8, and are displaying it currently using CP1252.
From: http://dcx.sybase.com/index.html#sa160/en/dbreference/unload-statement.html
BYTE ORDER MARK clause - Use this clause to specify whether a byte order mark (BOM) should be written. By default, this option is ON, provided the destination for the unload is a local or client file. When the BYTE ORDER MARK option is ON and the ENCODING is UTF-8 or UTF-16, then a BOM is written. If BYTE ORDER MARK is OFF, a BOM is not unloaded.
So, use BYTE ORDER MARK OFF
to not output the byte order mark. However, if you're not using the BOM, you should also be aware of the encoding choice on the output data:
ENCODING clause - All database data is translated from the database character encoding to the specified CHAR or NCHAR encoding. When ENCODING is not specified, the database's CHAR encoding is used.
Specify the BYTE ORDER MARK clause to include a byte order mark in the data.
Your database character encoding is UTF-8, so the default is ENCODING 'UTF-8'
to specify that the data is to be output using UTF-8 - you may need to specify an alternate encoding that matches your destination text encoding (e.g. ENCODING 'CP1252'
).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
30 | |
9 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.