Skip to content

Conversation

@bestopensors
Copy link

Description

Fixed UTF-8 encoding issues that caused Croatian characters (č, ć, đ, š, ž) to display as replacement characters (□) on PS4 and PC platforms.

Changes

  • Set UTF-8 locale at application startup before any file I/O operations
  • Fixed JSON file reading to properly handle UTF-8 encoding (i18n files, search history)
  • Added European font fallback for Croatian and other European characters
  • Set environment variables (LC_ALL, LANG) for proper locale handling
  • Updated borealis submodule with UTF-8 encoding fixes

Files Changed

  • app/src/main.cpp - UTF-8 locale setup
  • app/src/tab/search_tab.cpp - UTF-8 file reading/writing
  • library/borealis/library/lib/core/i18n.cpp - UTF-8 JSON parsing
  • library/borealis/library/lib/platforms/desktop/desktop_font.cpp - European font fallback
  • .gitignore - Added build scripts

Testing

✅ Tested on Linux desktop with Croatian content from Jellyfin server
✅ Characters now render correctly in:

  • Movie/show titles
  • Descriptions
  • Search results
  • All UI text

Screenshots

before:
image
image

after:
image
image

Platform Support

  • ✅ Linux (Desktop)
  • ✅ Windows (Desktop)
  • ✅ PS4
  • ✅ PC

Fixes issue where Croatian characters displayed as replacement characters.

- Set UTF-8 locale at application startup before any file I/O
- Fix JSON file reading to properly handle UTF-8 encoding
- Add European font fallback for Croatian characters (č, ć, đ, š, ž)
- Fix search history file reading/writing with UTF-8
- Set environment variables (LC_ALL, LANG) for proper locale handling

Fixes issue where Croatian characters displayed as replacement
characters (□) on PS4 and PC platforms. Characters now render
correctly in titles, descriptions, and search results.

Tested on Linux desktop with Croatian content from Jellyfin server.
@dragonflylee
Copy link
Owner

dragonflylee commented Jan 14, 2026

change for ‎library/borealis is not necessary

this->path = AppConfig::instance().configDir() + "/search.json";
std::ifstream readFile(this->path);
#if !defined(USE_BOOST_FILESYSTEM) || defined(_WIN32)
std::ifstream readFile(fs::u8path(this->path), std::ios::binary);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's for filename, not file content

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great thanks

…cters

- 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.
@dragonflylee
Copy link
Owner

dragonflylee commented Jan 14, 2026

@bestopensors
https://nightly.link/dragonflylee/switchfin/actions/runs/20980863997

this build updated font load, tested with windows

image

@bestopensors bestopensors force-pushed the feature/setup-development-environment branch from a9b2b05 to d58d455 Compare January 14, 2026 15:31
@bestopensors
Copy link
Author

I can't test on windows unfortunately

@dragonflylee
Copy link
Owner

I can't test on windows unfortunately

@bestopensors Can you help test the PS4 version of https://nightly.link/dragonflylee/switchfin/actions/runs/20980863997 ?

@bestopensors
Copy link
Author

yes I can do that

@bestopensors
Copy link
Author

@dragonflylee the utf encoding implemented in this pr (croatian/european) works on PS4 also

@dragonflylee
Copy link
Owner

@dragonflylee the utf encoding implemented in this pr (croatian/european) works on PS4 also

However, there is still a lot of redundant code here, and it cannot be compiled successfully on Windows. It seems to be AI-generated code.

- Remove nested try-catch blocks and setenv() calls (not available on Windows)
- Simplify locale setup to basic setlocale() call
- Fix Windows compilation issues from previous PR
@bestopensors bestopensors force-pushed the feature/setup-development-environment branch from a75b9ab to b6a7707 Compare January 26, 2026 20:25
@bestopensors
Copy link
Author

@dragonflylee the utf encoding implemented in this pr (croatian/european) works on PS4 also

However, there is still a lot of redundant code here, and it cannot be compiled successfully on Windows. It seems to be AI-generated code.

removed some of the redundant code, everything still works on linux. Yes the code is "kind of" AI generated but I will try to be more careful not to bloat everything.

@bestopensors
Copy link
Author

If you could send me the latest build with these changes, I will gladly test on ps4.

@dragonflylee
Copy link
Owner

dragonflylee commented Jan 28, 2026

@bestopensors The key modifications have been included in 3b3c632c

you can test PC/PS4 version from nightly

@bestopensors
Copy link
Author

PS4 version works very nicely :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants