{"id":21905332,"url":"https://github.com/pedrolcl/icu_qt_poc","last_synced_at":"2026-04-11T00:32:39.896Z","repository":{"id":128907978,"uuid":"462302983","full_name":"pedrolcl/icu_qt_poc","owner":"pedrolcl","description":"Integrating libICU for Unicode conversion and charset detection with Qt apps (POC)","archived":false,"fork":false,"pushed_at":"2022-10-08T19:52:01.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-27T07:28:45.612Z","etag":null,"topics":["icu","linux","macos","qt","unicode","windows"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pedrolcl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-22T13:09:47.000Z","updated_at":"2022-05-11T19:30:39.000Z","dependencies_parsed_at":"2023-05-19T00:00:57.731Z","dependency_job_id":null,"html_url":"https://github.com/pedrolcl/icu_qt_poc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedrolcl%2Ficu_qt_poc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedrolcl%2Ficu_qt_poc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedrolcl%2Ficu_qt_poc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pedrolcl%2Ficu_qt_poc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pedrolcl","download_url":"https://codeload.github.com/pedrolcl/icu_qt_poc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244918710,"owners_count":20531686,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["icu","linux","macos","qt","unicode","windows"],"created_at":"2024-11-28T16:32:51.281Z","updated_at":"2025-12-30T23:51:33.523Z","avatar_url":"https://github.com/pedrolcl.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ICUQtPOC - Integrating libICU for Unicode conversion and charset detection with a Qt app (POC)\n\nThis project is a proof-of-concept for using\n[libICU](https://icu.unicode.org/home)\nto convert text from any charset to [Unicode](https://home.unicode.org/),\nintegrated in a Qt app.\n\n## Why this exists?\n\nQt has a convenient class:\n[QTextCodec](https://doc.qt.io/qt-5/qtextcodec.html),\nthat performs conversion between Unicode and other character sets, until Qt5.\nIn Qt6 this class was moved from QtCore to the\n[Qt5Compat module](https://doc.qt.io/qt-6/qtcore5compat-module.html),\nwhich means that it will be relegated in maintenance\npriority, and it may be totally removed in the future.\n\nSee: https://bugreports.qt.io/browse/QTBUG-86437\n\nThere are two use cases for the Qt6 Core5Compat module:\n\n* To allow a quick and dirty port of some application to Qt6 without fully \nembracing the new API, perhaps for speed or pure laziness, but maybe to avoid \nsacrificing compatibility with Qt5.\n* To keep functionality that has been removed from Qt6 core modules, but moved \nto Core5Compat. This is the case of the QTextCodec class, which supports many \ntext encodings. This class is needed by Drumstick::File when decoding standard \nMIDI files. In fact, all MIDI applications that read standard MIDI files need \nto decode text metadata (credits, copyrights, lyrics, markers) from virtually \nany encoding available for the last 30 years. Keeping this functionality is \ncritical for data preservation. The alternative to using Core5Compat in this \ncase is using other libraries like libICU or libiconv, much worse to integrate \nin a Qt application.\n\nDrumstick::File is a library, belonging to the\n[Drumstick project](https://drumstick.sourceforge.io/), that supports\nInput/Output from\n[Standard MIDI Files](https://www.midi.org/specifications-old/item/standard-midi-files-smf)\n(.MID), which may include text metadata, like\nlyrics, comments, credits, copyrights, instrument names, markers and cue names. Some\nprograms based on Drumstick (like\n[kmidimon](https://kmidimon.sourceforge.io/) and\n[dmidiplayer](https://dmidiplayer.sourceforge.io/)\n) display metadata to the users, so the text needs to be converted to Unicode.\n\n## SMF metadata\n\n[The SMF standard](https://www.midi.org/specifications-old/item/standard-midi-files-smf)\nwas created as a file interchange format, so users could export\ncompositions from one MIDI sequencer proprietary format, and import those files\ninto another sequencer. Some sequencer hardware machines and software became\ndeprecated and unusable with time, and the data files in proprietary format\nbecame unreadable, losing work unless the users kept SMF exported files. Those\nfiles should now be treated as original manuscripts for \n[digital preservation](https://www.loc.gov/preservation/digital/formats/fdd/fdd000119.shtml).\n\nThe authors of the standard, naively stated that all text metadata should be\nencoded in ASCII within a MIDI file, omitting the fact that many cultures exist\naround the world needing other encodings to reliable store their languages. Of\ncourse, the result was that composers, manufacturers and software developers\nall over the world ignored that standard requirement and used whatever encoding\nthat was available at the time. Nowadays, a good encoding choice is UTF-8, and\nthis is what [Rosegarden](https://www.rosegardenmusic.com/)\ndoes when exports compositions as MIDI files. But for\nimporting from MIDI files, software apps need to convert from some unknown\nencodings into Unicode for processing.\n\n## Tested solution\n\nThis project does not read SMF files. Instead, it reads plain text files with\nunknown encodings, and tries to detect the input charset using the\n[ICU CharsetDetector](https://unicode-org.github.io/icu/userguide/conversion/detection.html#charsetdetector).\nThe user has a combobox to choose another charset if the detection is not \ncorrect. Then, the input data is converted to Unicode by\n[ICU Converters](https://unicode-org.github.io/icu/userguide/conversion/converters.html#icu-converters)\nand displayed to the user.\n\nThere is another POC, functionally equivalent:\n[alternative using iconv()](https://github.com/pedrolcl/iconv_qt_poc).\n\n## The ICU Nightmare in Qt\n\nIf you want to build this project using the Qt online installer libraries, you are \ngoing to experience problems. The Qt 6.3.0 libraries are compiled against icu 56,\nbut your system libs may be newer. For instance Fedora 35 comes with icu 69.\n\nThe problem is that the Qt online installer ships the icu development libraries\n(the files with the .so suffix, without a number) but not the corresponding icu\nheaders. The result is that when linking the project you will get errors like:\n\n    undefined reference to `ucnv_open_69'\n\nThat is because the compiler included the icu 69 headers installed in your \nsystem (at /usr/include), but the linker is trying to use the icu 56 libraries, \ninstalled by the online installer probably at your $HOME.\n\nOne solution is to use the pkg-config utility to find ICU, but another is to \nremove all the ICU development libraries from the Qt prefix. For instance:\n\n    libicudata.so        \u003c- remove this symlink!\n    libicudata.so.56     \u003c- leave this symlink alone\n    libicudata.so.56.1   \u003c- leave also the library file \n\nThis will allow the build to succeed, but will generate the following warnings:\n\n    /usr/bin/ld: warning: libicui18n.so.56, needed by libQt6Core.so.6.3.0, may conflict with libicui18n.so.69\n    /usr/bin/ld: warning: libicuuc.so.56, needed by libQt6Core.so.6.3.0, may conflict with libicuuc.so.69\n\nThere is no danger of conflict between the two versions, because all the exported \nsymbols of each library are named with the library version suffix. But there is\na problem creating a binary bundle containing your program and all the required\nruntime libraries: you will need to ship both versions, which are not small.\n\nSee: https://bugreports.qt.io/browse/QTBUG-27930, https://bugreports.qt.io/browse/QTBUG-103106\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedrolcl%2Ficu_qt_poc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpedrolcl%2Ficu_qt_poc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedrolcl%2Ficu_qt_poc/lists"}