mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
LibC: Implement CODESET for langinfo
This commit is contained in:
parent
5ea1810ada
commit
8f9af4a582
Notes:
sideshowbarker
2024-07-18 03:53:33 +09:00
Author: https://github.com/timschumi
Commit: 8f9af4a582
Pull-request: https://github.com/SerenityOS/serenity/pull/10058
4 changed files with 63 additions and 0 deletions
27
Userland/Libraries/LibC/langinfo.cpp
Normal file
27
Userland/Libraries/LibC/langinfo.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2021, the SerenityOS developers
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <langinfo.h>
|
||||
|
||||
static const char* __nl_langinfo(nl_item item)
|
||||
{
|
||||
switch (item) {
|
||||
case CODESET:
|
||||
return "UTF-8";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
char* nl_langinfo(nl_item item)
|
||||
{
|
||||
// POSIX states that returned strings should not be modified,
|
||||
// so this cast is probably fine.
|
||||
return const_cast<char*>(__nl_langinfo(item));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue