Skip to content

extra::time: test failure on Win32 non-English locale #9418

Closed
@klutzy

Description

@klutzy

libextra/time.rs has #[test] fn run_tests(), which fails on my machine (win8.1, korean locale):

task <unnamed> failed at 'assertion failed: (w != 0)', C:\home\stone\rust\src\libstd\str.rs:2052

It is because rust_localtime function in rt/rust_builtin.cpp uses

    if (strftime(buffer, sizeof(buffer), "%Z", &tm) > 0) { ... }

but it returns ANSI string rather than utf-8, so assertion failed at str.
In my machine buffer gets '\xb4\xeb\xc7\xd1\xb9\xce\xb1\xb9 \xc7\xa5\xc1\xd8\xbd\xc3', "대한민국 표준시" in CP949.

It is fixable by using wcsftime which returns utf-16. I'll try it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-windowsOperating system: Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions