Toad World® Forums

Toad 14.1 error executing scripts with SQLplus

Hi,
I've the following problem with Toad 14.1 which I can't reproduce with Toad 13.2
If I try to execute simple script like
select sysdate from dual;
I'll get "SP2-0734: Unbekannter Befehl ab "select ..." - restliche Zeile ignoriert." (sorry for the German error message)
I know that this is because of the lack of UTF support in SQLplus. My question is, how can I switch the charset in the SQL editor not to use "UTF8 with BOM" when running scripts with SQLplus?
As it is known that it's not supported, it should not even used for this by default...

The strange thing, if I prepare a file using UTF8 without BOM and load this file via drag'n drop into the SQL editor. then running this script with SQLplus works fine.

Could you please advise how to handle this?
As I mentioned above with TOAD 13.2 it works also when typing the commands into an empty SQL editor.

If you manually save the file in the editor, Toad will use the encoding specified in the save dialog.

If you open an existing file, the encoding will not be changed.

If you just type (or paste) something into the editor, then run it in SQLPlus, Toad will save it to a temporary file, encoded as ansi, then run that file in SQLPlus.

how can I switch the charset in the SQL editor not to use "UTF8 with BOM" when running scripts with SQLplus?

Maybe copy/paste it to a new tab before running in SQL*Plus? Or manually save as another file with ANSI?

If you just type (or paste) something into the editor, then run it in SQLPlus, Toad will save it to a temporary file, encoded as ansi, then run that file in SQLPlus.

I can't confirm this. If I open a new editor enter the select statement and click run with SQLPlus the I'll get the shown error.
If I do this with with a blank (or more preferred a comment) line in the first row then the select works because the error hits now the blank/comment line.

Hi Juergen,

I don't know how this can happen. I had another developer look at the code too, and we don't see any way that typed text, then Execute in SQL Plus could make anything but ansi-encoded files.

The output files are in your temporary folder, if you want to examine them. Go to Toad Options -> General to see where your temp file directory is. The files are named like TOA####.tmp when you run an unsaved script in SQLPlus. You can look at them with notepad, then do a "Save as" from Notepad and you'll see the file's encoding in the save dialog.

-John

I've tested it, the file is indeed an UTF8 with BOM formatted file (see attached file)
TOA2728.tmp.txt (30 Bytes)

Addon: I've tested it again this time I've saved it first into a file, checked that I use ANSI as encoding, which is, as you mentioned, the default and after saving I've run the script again with SQLplus with the same result... It contains the same three invisible chars.
I have no further ideas what I could check...
One thing I've found out that from Windows 10 1903 UTF8 with BOM is the default encoding for notepad. Maybe that could be the reason of this behavior?

I've tested it again this time I've saved it first into a file, checked that I use ANSI as encoding, which is, as you mentioned, the default and after saving I've run the script again with SQLplus with the same result... It contains the same three invisible chars.

It seems like something on your system is either adding the UTF8 encoding, or maybe your system has ANSI mapped to UTF8. I've never heard of this happening before and don't even know if it is possible. I suppose if you use notepad to resave it as ansi, then it actually saves as ansi?

Edit: I just tried this in notepad on win 10....type in a few characters, save as ansi, and re-open the file. notepad says the file is UTF8 (no bom). But the file runs OK in SQL*Plus.

I found this: How to Change Notepad Default Encoding in Windows 10 | Password Recovery for changing the default in notepad. I changed the default to UTF8 with BOM but it didn't change Toad's behavior.

I've tested it with notepad. If I save as ANSI then it is ANSI.
I've also tested it on a different PC, there is also not problem. I've de-installed and reinstalled TOAD on my PC but the problem still exists. So indeed it seems to be something outside TOAD. Maybe I'll try to reinstall Oracle also.
Anyway thank you for your support!

OK. Please let us know if you find the problem.