Why it is not possible to use the UNLOAD Statement to write in a file using ENCODING 'ANSI'?


unload select 'blabla' to 'c:\temp\mytest.txt' encoding 'UTF-8' --> OK

unload select 'blabla' to 'c:\temp\mytest.txt' encoding 'UNICODE' --> OK

unload select 'blabla' to 'c:\temp\mytest.txt' encoding 'ANSII' --> Error

asked 28 Jun '22, 10:35

Baron's gravatar image

accept rate: 48%

Because ANSI (and the misspelled ANSII) is not an actual encoding in SQL Anywhere terms but a group of code pages (and as such, different from OEM code pages).

Try to use a particular code page name, say

unload select 'blabla' to 'c:\temp\mytest.txt' encoding 'windows-1252'


unload select 'blabla' to 'c:\temp\mytest.txt' encoding 'cp1252'

or (probably reduced to 7 bits)

unload select 'blabla' to 'c:\temp\mytest.txt' encoding 'ascii'

You can get a list of the supported encodings (and their many aliases) viat "dbinit -le" or even "dbinit -le+".

permanent link

answered 28 Jun '22, 10:46

Volker%20Barth's gravatar image

Volker Barth
accept rate: 34%

edited 28 Jun '22, 10:55


BTW, you can also use 'os_charset' as an alias for the OS charset. On Windows, that would be the ANSI charset (as opposed to the OEM charset). The Windows ANSI charset is what non-Unicode GUI applications use; the Windows OEM charset is what non-Unicode command-line / Terminal applications use. They are often different. On UNIX, the OS charset is whatever your shell is configured to use (via the LANG environment variable).

(28 Jun '22, 12:45) John Smirnios
Replies hidden

> is whatever

No offense, but...

That is exactly how I feel about encoding, character sets and code pages in general :)

(28 Jun '22, 15:22) Breck Carter

I'm quite sure you have forgot collations :)

(29 Jun '22, 12:38) Volker Barth
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 28 Jun '22, 10:35

question was seen: 550 times

last updated: 29 Jun '22, 12:38