All Manuals > Foreign Language Interface User Guide and Reference Manual > 7 Function, Macro and Variable Reference

set-locale Function

Summary

Sets the C locale and the default for FLI string conversions.

Package

fli

Signature

set-locale &optional locale => c-locale

Arguments
locale
A string, the locale name.
Values
c-locale
A string naming the C locale, or nil..
Description

The function set-locale can be called to set the C locale; if you set the locale in any other way, then Lisp might not do the right thing when passing strings and characters to C. It calls setlocale to tell the C library to switch and then calls set-locale-encodings to tell the FLI what conversions to do when passing strings and characters to C. locale should be a locale name; if not passed, it defaults according to the OS conventions.

If set-locale fails to set the C locale, a warning is signaled, nil is returned and the FLI conversion defaults are not modified.

Examples

On a Windows system:

(fli:set-locale "English_UK")
=> 
"English_United Kingdom.1252"

On a Linux system:

(fli:set-locale)
=>
"en_US"
See also

convert-from-foreign-string
convert-to-foreign-string
:ef-mb-string
:ef-wc-string
*locale-external-formats*
set-locale-encodings
with-foreign-string


Foreign Language Interface User Guide and Reference Manual - 01 Dec 2021 19:34:58