0

I have text file that contains an SQL that queries a phrase in hebrew.

I wrote the SQL in VSCODE using utf-8 encoding.

Now i have to run this sql using a teradata utility called bteq. this utility uses ascii encoding.

I tried to reopen or save the file in VSCODE with new encoding but couldn't find an ascii encoding.

In ultra-edit editor there is an ascii encoding and when i copy paste the sql to ultra-edit and save it with ascii encoding the sql runs successfully.

Is there any way to use VSCODE to save the file in ascii encoding?

Update: 2022-05-23

Following the comments:

The reason i need this is that i work with a teradata database.

The tool with which which the SQL is written is called "Teradata Assistant".

Teradata assistant version is: 16.20.0.9 2019-10-25

Database version is: 16.20.53.48

With this tool i can write the sql with hebrew letters and save it as a text file.

When i open the file with teradata assistant the file is displayed correctly with the hebrew letters.

However when i open the same file with VSCODE using UTF-8 all the hebrew letters are replaced with this symbol: �

Finally when i open the file with notepad with ANSI encoding the file is opened with the hebrew letters displayed correctly.

I find it odd that VSCODE can't do something that notepad can do..

Rafael Zanzoori
  • 531
  • 1
  • 7
  • 23
  • https://stackoverflow.com/questions/30082741/change-the-encoding-of-a-file-in-visual-studio-code – Chandan kushwaha May 04 '22 at 09:04
  • Check this link @Rafael – Chandan kushwaha May 04 '22 at 09:05
  • Thanks. i stumbled across that link in my preliminary search. However there is no ASCII encoding among the options in the "select file encoding" dropdown in VSCODE. I understand that ASCII is a 7-bit encoding, and i need that or an equivalent encoding that the utility can read. – Rafael Zanzoori May 04 '22 at 09:12
  • It looks like you can't really enforce ASCII using Visual Studio Code. UTF-8 is a superset of ASCII, it should work for you as long as you don't type non-ASCII characters. – Álvaro González May 04 '22 at 09:16
  • with ultra edit how does it encode hebrew characters in an ASCII encoding, have you used a hex editor to view the result – rioV8 May 04 '22 at 15:26
  • I totally missed the Hebrew bit... It's physically impossible to store Hebrew in ASCII. It's hard to believe that a data tool doesn't support UTF-8 in 2022. Is it possible that's failing because you're feeding it with [mojibake](https://en.wikipedia.org/wiki/Mojibake) rather than valid UTF-8? – Álvaro González May 05 '22 at 06:13
  • I have added more details to the problem description. – Rafael Zanzoori May 23 '22 at 10:12
  • BTEQ just defaults to ASCII, but you can change it, of course. `bteq -c UTF8` should be what you want. See [Encoding Controls for Unicode Sessions](https://docs.teradata.com/r/Basic-Teradata-Query-Reference/February-2022/Starting-and-Exiting-BTEQ/Starting-a-BTEQ-Session/Encoding-Controls-for-Unicode-Sessions) – dnoeth May 23 '22 at 14:52
  • Thanks @dnoeth - i tried: `bteq -c UTF8 < mybteq.sql > log.txt` but log.txt shows that 0 rows were returned. But when i copy&paste the same query from VSCODE to teradata assistant, correct results are displayed. – Rafael Zanzoori May 24 '22 at 09:30

0 Answers0