How to Work with Different Encodings in CAPL

Question:
How to convert CAPL files to different encodings
Answer:

If you create a new CAPL file in CANoe, the default Windows code page/encoding of the local computer's operating system is used. The code page represents the set of available characters which usually contains the seven-bit ASCII characters plus additional characters.

The numeric representation of it is automatically written into the first line of the CAPL file when it is created. In the example below encoding CP1252/Windows-1252 is used which corresponds to Western European):

This line does only tell the compiler which encoding is used in the CAPL file. Changing it to another encoding here, e.g. to. /*@!Encoding:65001*/ for UTF-8 does not convert the CAPL file into the new format.

If you want to work with UTF-8, you have to open the file in an external text editor (e.g. Notepad++) and save/convert the file to UTF-8 first.

Afterwards open the file with the CAPL editor and change the first line to
/*@!Encoding:65001*/
After saving it, the compiler recognizes/handles the file as UTF-8 formatted file.

Note:

It is also possible to “limit” the set of available characters to ASCII by using the following encoding:
/*@!Encoding:ASCII*/



Article ID: 1124
Last updated: 2020-04-20
Revision: 8
CANalyzer/CANoe -> CAPL -> How to Work with Different Encodings in CAPL
https://kb.vector.com/entry/1124/