Source code encoding (-sources-encoding
)
Specify the encoding of source files
Description
Specify the encoding of the source files that you analyze with Polyspace.
Use this option only if you see compilation errors or display issues from non-ASCII characters in your source files. The option forces an internal conversion of your source files from the specified encoding to an UTF-8 encoding and might help resolve the issue.
Set Option
User interface (desktop products only): In your project configuration, the option is on the Environment Settings node.
User interface (Polyspace Platform, desktop products only): In your project configuration, the option is in the Project tab.
Command line and options file: Use the option
-sources-encoding
. See Command-Line Information.
Why Use This Option
The analysis uses the default encoding of your operating system as the source code encoding. In most cases, if your source code contains non-ASCII characters, for instance, Japanese or Korean characters, the Polyspace® analysis can interpret the characters and later display the source code correctly.
If you still have compilation errors or display issues from non-ASCII characters, you might be using an encoding that is different from the default encoding. You can then specify your source code encoding explicitly using this option.
Settings
Default:
system
system
The analysis uses the default encoding of the operating system.
shift-jis
The analysis uses the Shift JIS (Shift Japanese Industrial Standards) encoding, a character encoding for the Japanese language.
iso-8859-1
The analysis uses the ISO/IEC 8859-1:1998 encoding, a character encoding that encodes what it refers to as "Latin alphabet no.1", consisting of 191 characters from the Latin script.
windows-1252
The analysis uses the Windows-1252 encoding, a single-byte character encoding of the Latin alphabet, used by default in the legacy components of Windows® for English and some other Western languages.
UTF-8
The analysis uses the UTF-8 encoding, a variable width character encoding capable of encoding all valid code points in Unicode.
Auto
(Polyspace Platform only) The analysis uses internal heuristics to determine the encoding of your source files from their contents. This can be useful if your source files contain a mix of different encodings.
Polyspace supports many more encodings. To specify an encoding that is not in the above
list in the Polyspace user interface, enter -sources-encoding
in the encodingname
Other
field. In particular, if
your source files contain a mix of different encodings, you can use -sources-encoding
auto
.
For the full list of supported encodings, at the command line, enter:
-list-all-values -sources-encoding
polyspace-bug-finder
, polyspace-code-prover
,
polyspace-bug-finder-server
or
polyspace-code-prover-server
command. Pipe the output to a file and
search the file for the encoding that you are using.Command-Line Information
Parameter:
-sources-encoding |
Default:
system |
Value:
auto | system | shift-jis |
iso-8859-1 | windows-1252 |
UTF-8 |
Example (Bug Finder):
polyspace-bug-finder -sources-encoding windows-1252 |
Example (Code Prover):
polyspace-code-prover -sources-encoding windows-1252 |
Example (Bug Finder Server):
polyspace-bug-finder-server -sources-encoding
windows-1252 |
Example (Code Prover Server):
polyspace-code-prover-server -sources-encoding windows-1252 |
Polyspace supports many more encodings besides the above list. For the full list of supported encodings, at the command line, enter:
-list-all-values -sources-encoding
polyspace-bug-finder
, polyspace-code-prover
,
polyspace-bug-finder-server
or
polyspace-code-prover-server
command. Pipe the output to a file and
search the file for the encoding that you are using.