Skip to content

Commit

Permalink
always use C locale on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
usamoi committed Nov 1, 2024
1 parent 5e1aab9 commit c6b6866
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pgrx-pg-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ pub static BASE_POSTGRES_TESTING_PORT_NO: u16 = 32200;
/// The flags to specify to get a "C.UTF-8" locale on this system, or "C" locale on systems without
/// a "C.UTF-8" locale equivalent.
pub fn get_c_locale_flags() -> &'static [&'static str] {
#[cfg(target_os = "macos")]
{
&["--locale=C", "--lc-ctype=UTF-8"]
}
#[cfg(not(target_os = "macos"))]
#[cfg(all(target_family = "unix", not(target_os = "macos")))]
{
match Command::new("locale").arg("-a").output() {
Ok(cmd)
Expand All @@ -47,6 +43,14 @@ pub fn get_c_locale_flags() -> &'static [&'static str] {
_ => &["--locale=C"],
}
}
#[cfg(target_os = "macos")]
{
&["--locale=C", "--lc-ctype=UTF-8"]
}
#[cfg(target_os = "windows")]
{
&["--locale=C"]
}
}

// These methods were originally in `pgrx-utils`, but in an effort to consolidate
Expand Down

0 comments on commit c6b6866

Please sign in to comment.