...
| ! | " | # | $ | % | & | ' | ( | ) | * | + | , | - | . | / | ||
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | : | ; | < | = | > | ? | ||
@ | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | ||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="65b1c1772b48c387-b1e30763-426b4aba-bd40b090-b2dcaf6b713c899b4ac96239"><ac:plain-text-body><![CDATA[ | P | Q | R | S | T | U | V | W | X | Y | Z | [ | \ | ] | ^ | _ | ]]></ac:plain-text-body></ac:structured-macro> |
' | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | ||
p | q | r | s | t | u | v | w | x | y | z | { | | | } | ~ |
...
When naming files, variables, data files etc., it is often best to use only the characters listed above.
Non-Compliant Coding Example
The characters in the file name should be avoided.
...
Code Block |
---|
% ls
a.out MSC09-A.c ??????
|
Compliant Solution
Use a descriptive file name, containing only the subset of ASCII described above.
Code Block | ||
---|---|---|
| ||
#include <fcntl.h> #include <sys/stat.h> int main() { char *file_name = "name.ext"; mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; int fd = open(file_name, O_CREAT | O_EXCL | O_WRONLY, mode); if (fd == -1) { /* Handle Error */ } } |
Risk Assessment
This could result in data being lost or misinterpreted during transmission.
Reference
Wiki Markup |
---|
\[[Kuhn 06|AA. C References#Kuhn 06]\] UTF-8 and Unicode FAQ for Unix/Linux \[[ISO/IEC 646-1991|AA. C References#ISO/IEC 646-1991]\] ISO 7-bit coded character set for information interchange \[[ISO/IEC 9899-1999:TC2|AA. C References#ISO/IEC 9899-1999TC2]] Section 5.2.1, "Character sets" |