Top Related Projects
The Foundation Project, providing core utilities, internationalization, and OS independence
Node.js JavaScript runtime ✨🐢🚀✨
The Python programming language
Empowering everyone to build reliable and efficient software.
.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
Quick Overview
ICU (International Components for Unicode) is a mature, widely used set of C/C++ and Java libraries providing Unicode and Globalization support for software applications. It offers comprehensive services for Unicode, software internationalization, and globalization, including text handling, formatting, and scanning.
Pros
- Comprehensive support for Unicode and internationalization
- Cross-platform compatibility (Windows, Unix, Linux, macOS)
- Extensive language and locale coverage
- Well-maintained and actively developed
Cons
- Large library size, which may impact application size
- Steep learning curve due to its extensive API
- Can be complex to integrate and configure for specific use cases
- Performance overhead for some operations compared to native implementations
Code Examples
- String comparison using ICU Collator:
#include <unicode/ucol.h>
#include <unicode/ustring.h>
UErrorCode status = U_ZERO_ERROR;
UCollator *collator = ucol_open("en_US", &status);
UChar str1[] = u"apple";
UChar str2[] = u"banana";
int result = ucol_strcoll(collator, str1, -1, str2, -1);
// result < 0 means str1 comes before str2 in sorted order
ucol_close(collator);
- Date formatting using ICU DateFormat:
#include <unicode/unistr.h>
#include <unicode/datefmt.h>
UErrorCode status = U_ZERO_ERROR;
DateFormat* df = DateFormat::createDateTimeInstance(DateFormat::FULL, DateFormat::FULL, Locale("en_US"));
UDate now = Calendar::getNow();
UnicodeString dateString;
df->format(now, dateString);
// dateString now contains the formatted date and time
delete df;
- Number formatting using ICU NumberFormat:
#include <unicode/unistr.h>
#include <unicode/numfmt.h>
UErrorCode status = U_ZERO_ERROR;
NumberFormat* nf = NumberFormat::createInstance(Locale("fr_FR"), status);
double number = 1234567.89;
UnicodeString formattedNumber;
nf->format(number, formattedNumber);
// formattedNumber now contains the number formatted according to French locale
delete nf;
Getting Started
To use ICU in your C++ project:
- Install ICU libraries and development files for your platform.
- Include necessary headers in your source files.
- Link against ICU libraries when compiling.
Example compilation command:
g++ -std=c++11 your_file.cpp -o your_program -licuuc -licui18n `pkg-config --cflags icu-i18n`
Make sure to handle errors and check status codes in your actual implementation.
Competitor Comparisons
The Foundation Project, providing core utilities, internationalization, and OS independence
Pros of swift-corelibs-foundation
- Specifically designed for Swift, providing seamless integration with Swift projects
- Offers a comprehensive set of Foundation APIs for Swift developers
- Actively maintained by the Swift community, ensuring compatibility with the latest Swift versions
Cons of swift-corelibs-foundation
- Limited to Swift ecosystem, not suitable for cross-platform or multi-language projects
- May lack some advanced internationalization features found in ICU
- Smaller community and ecosystem compared to ICU
Code Comparison
ICU (C++):
UnicodeString str = UnicodeString::fromUTF8("Hello, World!");
BreakIterator* bi = BreakIterator::createWordInstance(Locale::getUS(), status);
bi->setText(str);
swift-corelibs-foundation (Swift):
let str = "Hello, World!"
let range = str.range(of: "World")
let substring = str[range!]
Summary
While ICU provides robust internationalization support across multiple platforms and languages, swift-corelibs-foundation focuses on delivering a native Swift experience for Foundation APIs. ICU offers more advanced internationalization features, but swift-corelibs-foundation provides better integration with Swift projects. The choice between the two depends on the specific project requirements, target platforms, and programming language preferences.
Node.js JavaScript runtime ✨🐢🚀✨
Pros of Node.js
- Larger community and ecosystem, with more contributors and third-party packages
- More versatile, supporting a wide range of applications beyond internationalization
- Faster development cycle with frequent updates and releases
Cons of Node.js
- Less specialized in internationalization and Unicode support compared to ICU
- Potentially higher resource usage and larger footprint for simple applications
- Steeper learning curve for developers new to JavaScript or asynchronous programming
Code Comparison
ICU (C++):
UnicodeString str("Hello, World!");
UnicodeString upper;
str.toUpper(upper);
Node.js (JavaScript):
const str = "Hello, World!";
const upper = str.toUpperCase();
Both examples demonstrate string manipulation, but ICU offers more specialized Unicode handling, while Node.js provides a simpler, more general-purpose approach. ICU's implementation is more low-level and potentially more efficient for complex Unicode operations, whereas Node.js offers a more accessible API for common string manipulations.
Node.js integrates ICU for its internationalization features, combining the strengths of both projects. This integration allows Node.js to leverage ICU's robust Unicode support while providing a more familiar JavaScript interface for developers.
The Python programming language
Pros of CPython
- Larger and more active community, with more frequent updates and contributions
- Broader scope, covering the entire Python language implementation
- More extensive documentation and learning resources available
Cons of CPython
- Larger codebase, potentially more complex to navigate for newcomers
- Less specialized focus on internationalization and localization compared to ICU
Code Comparison
ICU (C++):
UnicodeString str("Hello, World!");
UnicodeString upper;
str.toUpper(upper);
CPython (C):
PyObject *str = PyUnicode_FromString("Hello, World!");
PyObject *upper = PyObject_CallMethod(str, "upper", NULL);
Both repositories provide essential functionality for their respective domains. ICU focuses on Unicode and internationalization support, while CPython implements the entire Python programming language. CPython's broader scope makes it more versatile but potentially more complex, while ICU's specialized focus allows for more in-depth internationalization features.
CPython's larger community and more frequent updates can lead to faster bug fixes and feature additions. However, ICU's specialized nature may provide more comprehensive internationalization support out-of-the-box.
The code comparison shows that both libraries offer similar functionality for string manipulation, but with different syntax and approaches due to their distinct purposes and target languages.
Empowering everyone to build reliable and efficient software.
Pros of Rust
- Larger community and more active development
- Broader scope as a general-purpose programming language
- More comprehensive documentation and learning resources
Cons of Rust
- Steeper learning curve for beginners
- Longer compilation times compared to ICU
- Less specialized for internationalization tasks
Code Comparison
ICU (C++):
UnicodeString str("Hello, World!");
BreakIterator* bi = BreakIterator::createWordInstance(Locale::getUS(), status);
bi->setText(str);
int32_t start = bi->first();
int32_t end = bi->next();
Rust:
let s = String::from("Hello, World!");
let words: Vec<&str> = s.split_whitespace().collect();
for word in words {
println!("{}", word);
}
The ICU example demonstrates word boundary detection using a specialized iterator, while the Rust example shows a simpler string splitting approach. ICU provides more advanced internationalization features out-of-the-box, whereas Rust would require additional libraries for similar functionality.
Both repositories are open-source and actively maintained, but Rust has a larger contributor base and more frequent updates. ICU focuses specifically on Unicode and internationalization support, while Rust is a full-fledged programming language with a wider range of applications.
.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
Pros of runtime
- Broader scope, covering the entire .NET runtime and core libraries
- More active development with frequent updates and contributions
- Extensive documentation and community support
Cons of runtime
- Larger codebase, potentially more complex to navigate and contribute to
- Primarily focused on .NET ecosystem, less specialized for internationalization
Code Comparison
ICU (C++):
UnicodeString str("Hello, World!");
BreakIterator* bi = BreakIterator::createWordInstance(Locale::getUS(), status);
bi->setText(str);
runtime (C#):
string str = "Hello, World!";
var wordEnumerator = StringInfo.GetTextElementEnumerator(str);
while (wordEnumerator.MoveNext())
{
Console.WriteLine(wordEnumerator.GetTextElement());
}
Summary
ICU is specialized for Unicode and internationalization support, while runtime covers a broader range of functionality for the .NET ecosystem. ICU may be more suitable for projects requiring deep internationalization features, whereas runtime is ideal for .NET development with built-in localization support. Both projects have active communities and regular updates, but runtime generally sees more frequent contributions due to its wider scope.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
How to create a Fedora docker image
For the general process and concepts see: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry
For our case I replaced the generic names with our own owner / repo / names / etc.
Run
docker login ghcr.io
When prompted use these:
- User: the github user
- Password: the github token
Update the timestamp (20240929
) with the current date, ISO style:
docker build --tag ghcr.io/unicode-org/fedora-docker-gcr:20240929 -f Dockerfile_fedora .
docker push ghcr.io/unicode-org/fedora-docker-gcr:20240929
For more info see: https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images
and: https://stackoverflow.com/questions/64033686/how-can-i-use-private-docker-image-in-github-actions
To consider: generate and publish the docker image from a GitHub action.
The DOCKER_CONTAINER_USER_NAME
and DOCKER_CONTAINER_REGISTRY_TOKEN
used
in the action file for user and password are secrets already created.
They can be any GitHub user + token with the proper access rights. Right now this is a token of the icu-robot account.
Top Related Projects
The Foundation Project, providing core utilities, internationalization, and OS independence
Node.js JavaScript runtime ✨🐢🚀✨
The Python programming language
Empowering everyone to build reliable and efficient software.
.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot