Skip to content

Commit

Permalink
Extend UTF-8 detection in PGX init and test (#1041)
Browse files Browse the repository at this point in the history
Newer versions of Ubuntu output locale names differently, breaking
the locale detection.
  • Loading branch information
sumerman authored Feb 15, 2023
1 parent 7cc73ae commit 2d53baa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pgx-pg-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ pub fn get_c_locale_flags() -> &'static [&'static str] {
#[cfg(not(target_os = "macos"))]
{
match Command::new("locale").arg("-a").output() {
Ok(cmd) if String::from_utf8_lossy(&cmd.stdout).lines().any(|l| l == "C.UTF-8") => {
Ok(cmd)
if String::from_utf8_lossy(&cmd.stdout)
.lines()
.any(|l| l == "C.UTF-8" || l == "C.utf8") =>
{
&["--locale=C.UTF-8"]
}
// fallback to C if we can't list locales or don't have C.UTF-8
Expand Down

0 comments on commit 2d53baa

Please sign in to comment.