convert_UTF8_to_local
Entity: function
Warning: This function is not available in the Light edition.

Usage:
Return is convert_UTF8_to_local(String, Type)

This function converts the string String from UTF-8 to 8 bit char set (if it can find proper char set). The number of the new char set will be returned in the variable Type. If the string is converted then this number is between 1 and 10 (i.e. will be one of the Windows char sets). If the string is not correct Unicode string then this number will be minus one. If the function cannot find char set which contains all symbols from the string then it returns the same string which is in UTF-8 format and in Type returns 0 (which is the number of UTF-8). If all symbols are in US ASCII then Type will stay free variable. (In this case the string can be considered as in any char set because US ASCII is subset to all char sets). If you check Type=2 then this will be true if the returned string is in char set 2 or in US ASCII. If you check Type=:=2 then this will be true only if the returned string is in the char set 2.

The return string is correct and no symbol in it is replaced with '?'. If convert_UTF8_to_local cannot find 8 bit char set which contains all symbols from the string then it returns the same string without change.

When one char set will be recognised?

If the string fit to char set 2 (Western European) then it will be converted to this char set for sure.

If the string is not in the char set 2 but is in char set 1 (Cyrillic) then it will be converted to the char set 1 for sure.

If the string contains some special symbol which is special for some of the char sets from 3 to 10 and if the string can be converted to this char set then it will be for sure. For example if the string contains a Greek letter and if the string fits in char set 3 (Greek) then it will be converted to char set 3 for sure.

Example:

?- Name is char_set_name(2, l), write(Name).

See also:
char sets table
char_set_name
convert_charset

Look at the example:
char_sets.spj (in folder Examples)