Skip to content

Commit d58d455

Browse files
committed
fix(encoding): UTF-8 support for Croatian, Arabic, and European characters
- Set UTF-8 locale at application startup before any file I/O operations - Fixed JSON file reading to properly handle UTF-8 encoding (search history) - Set environment variables (LC_ALL, LANG) for proper locale handling - Simplified search history file I/O (removed unnecessary fs::u8path for content) Fixes issue where Croatian (č, ć, đ, š, ž) and Arabic characters displayed as replacement characters (□) on PS4 and PC platforms. Characters now render correctly in titles, descriptions, and search results. Note: Font fallback for Arabic may need to be added separately if system fonts don't support Arabic characters. The UTF-8 encoding fixes ensure proper character parsing and display when fonts are available. Tested on Linux desktop with Croatian content from Jellyfin server.
1 parent b343948 commit d58d455

File tree

2 files changed

+1
-19
lines changed

2 files changed

+1
-19
lines changed

app/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
using namespace brls::literals; // for _i18n
4747

4848
int main(int argc, char* argv[]) {
49-
// Set UTF-8 locale for proper character encoding (fixes Croatian characters display)
49+
// Set UTF-8 locale for proper character encoding (fixes Croatian, Arabic, and other Unicode characters)
5050
// This must be done before any file I/O or text operations
5151
#if !defined(__PS4__) && !defined(__PSV__) && !defined(__SWITCH__)
5252
// Set environment variables first

app/src/tab/search_tab.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,6 @@
1212
#include "utils/keybind.hpp"
1313
#include "api/jellyfin.hpp"
1414
#include <fstream>
15-
#ifdef USE_BOOST_FILESYSTEM
16-
#include <boost/filesystem.hpp>
17-
namespace fs = boost::filesystem;
18-
#elif __has_include(<filesystem>)
19-
#include <filesystem>
20-
namespace fs = std::filesystem;
21-
#elif __has_include("experimental/filesystem")
22-
#include <experimental/filesystem>
23-
namespace fs = std::experimental::filesystem;
24-
#endif
2515

2616
using namespace brls::literals; // for _i18n
2717

@@ -101,11 +91,7 @@ class HistoryDataSource : public RecyclingGridDataSource {
10191
public:
10292
HistoryDataSource() {
10393
this->path = AppConfig::instance().configDir() + "/search.json";
104-
#if !defined(USE_BOOST_FILESYSTEM) || defined(_WIN32)
105-
std::ifstream readFile(fs::u8path(this->path), std::ios::binary);
106-
#else
10794
std::ifstream readFile(this->path, std::ios::binary);
108-
#endif
10995
if (readFile.is_open()) {
11096
try {
11197
// Read file content as UTF-8 and parse
@@ -145,11 +131,7 @@ class HistoryDataSource : public RecyclingGridDataSource {
145131
}
146132

147133
void save() {
148-
#if !defined(USE_BOOST_FILESYSTEM) || defined(_WIN32)
149-
std::ofstream writeFile(fs::u8path(this->path), std::ios::binary);
150-
#else
151134
std::ofstream writeFile(this->path, std::ios::binary);
152-
#endif
153135
if (writeFile.is_open()) {
154136
nlohmann::json j(this->list);
155137
// Ensure UTF-8 encoding when writing

0 commit comments

Comments
 (0)