C functions, such as strstr , work with raw char data, regardless of encoding. In this case, you potentially have two different encodings: one that is used by the compiler for the string literal, and one that you used when filling out buf . If this is not the same, then the function may not work as expected.
As for the default encoding, there is no one, at least not as a standard; "the main symbol of the execution of" set "is the implementation. In practice, systems that do not use the encoding obtained from ASCII (ISO 8859-1 seems to be the most common, the least here in Europe) are extremely rare. As for the encoding you get in buf , which depends on where the characters istream from; if you are reading with istream , it depends on the locale imbue d in the stream. In practice, however, again, almost all of them (UTF-8, ISO8859-x, etc. .) obtained from ASCII and are identical to ASCII for all characters in the main characters (which includes all persons Ms legitimate traditional C). Thus, for "UNB" , you'll probably be safe. (but for something like "รผรฉรข" , you will almost certainly not.)
source share