{"id":13740844,"url":"https://github.com/sillsdev/icu-dotnet","last_synced_at":"2025-12-29T23:56:10.950Z","repository":{"id":39380235,"uuid":"14127881","full_name":"sillsdev/icu-dotnet","owner":"sillsdev","description":"C# wrapper for ICU4C","archived":false,"fork":false,"pushed_at":"2025-02-25T13:34:58.000Z","size":42649,"stargazers_count":70,"open_issues_count":11,"forks_count":33,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-23T04:52:10.536Z","etag":null,"topics":["c-sharp","cross-platform","hacktoberfest","icu","icu-dotnet","icu4c","linux","nuget","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sillsdev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"custom":"https://www.givedirect.org/donate/?cid=13536\u0026dd1=Language%20Software"}},"created_at":"2013-11-05T00:34:25.000Z","updated_at":"2025-04-18T07:29:45.000Z","dependencies_parsed_at":"2024-06-11T23:53:58.298Z","dependency_job_id":"28e9fd73-8fe1-414f-a083-5bde83cab37f","html_url":"https://github.com/sillsdev/icu-dotnet","commit_stats":{"total_commits":499,"total_committers":33,"mean_commits":"15.121212121212121","dds":0.5651302605210421,"last_synced_commit":"ec6f567218158553ee14356b5fe60b9d17007ef5"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sillsdev%2Ficu-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sillsdev%2Ficu-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sillsdev%2Ficu-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sillsdev%2Ficu-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sillsdev","download_url":"https://codeload.github.com/sillsdev/icu-dotnet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253145087,"owners_count":21861185,"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":["c-sharp","cross-platform","hacktoberfest","icu","icu-dotnet","icu4c","linux","nuget","unicode","windows"],"created_at":"2024-08-03T04:00:52.833Z","updated_at":"2025-12-29T23:56:10.914Z","avatar_url":"https://github.com/sillsdev.png","language":"C#","readme":"# icu.net\n\n## Overview\n\nicu-dotnet is the C# wrapper for a subset of [ICU](https://icu.unicode.org/).\n\n\u003e ICU is a mature, widely used set of C/C++ and Java libraries providing Unicode and Globalization support\n\u003e for software applications. ICU is widely portable and gives applications the same results on all platforms\n\u003e and between C/C++ and Java software.\n\n[![NuGet version (icu.net)](https://img.shields.io/nuget/v/icu.net.svg?style=flat-square)](https://www.nuget.org/packages/icu.net/)\n[![Build, Test and Pack](https://github.com/sillsdev/icu-dotnet/actions/workflows/CI-CD.yml/badge.svg)](https://github.com/sillsdev/icu-dotnet/actions/workflows/CI-CD.yml)\n\n## Usage\n\nThis library provides .NET classes and methods for (a subset of) the ICU C API. Please refer to the\n[ICU API documentation](https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/). In icu.net\nyou'll find classes that correspond to the C++ classes of ICU4C.\n\nAlthough not strictly required it is recommended to call `Icu.Wrapper.Init()` at the start of\nthe application. This will allow to use icu.net from multiple threads\n(c.f. [ICU Initialization and Termination](https://unicode-org.github.io/icu/userguide/icu/design.html#icu4c-initialization-and-termination)).\nSimilarly, it might be beneficial to call `Icu.Wrapper.Cleanup()` before exiting.\n\nSample code:\n\n``` csharp\n    static class Program\n    {\n        public static void Main(string[] args)\n        {\n            Icu.Wrapper.Init();\n            // Will output \"NFC form of XA\\u0308bc is XÄbc\"\n            Console.WriteLine($\"NFC form of XA\\\\u0308bc is {Icu.Normalizer.Normalize(\"XA\\u0308bc\",\n                Icu.Normalizer.UNormalizationMode.UNORM_NFC)}\");\n            Icu.Wrapper.Cleanup();\n        }\n    }\n```\n\n## Building\n\nTo build the current version of icu-dotnet you'll need .NET 8.0 installed.\n\nicu-dotnet can be built from the command line as well as Visual Studio or JetBrains Rider.\n\n### Running Unit Tests\n\nYou can build and run the unit tests by running:\n\n```bash\ndotnet test source/icu.net.sln\n```\n\nor, if wanting to run tests on just one specific .net version (v8.0 in this example):\n\n```bash\ndotnet test source/icu.net.sln -p:TargetFramework=net8.0\n```\n\n### Linux and macOS\n\nIt is important for `icu.net.dll.config` to be bundled with your application when not\nrunning on Windows. If it doesn't copy reliably to the output directory, you might find\nadding something like the following to your `csproj` file will resolve the issue. Note\nthat the version number in the path must match the version number of icu.net that is\nreferenced in the project.\n\n```xml\n\u003cItemGroup\u003e\n  \u003cNone Update=\"$(NuGetPackageRoot)\\icu.net\\2.9.0\\contentFiles\\any\\any\\icu.net.dll.config\"\u003e\n    \u003cCopyToOutputDirectory\u003eAlways\u003c/CopyToOutputDirectory\u003e\n  \u003c/None\u003e\n\u003c/ItemGroup\u003e\n```\n\n### Docker\n\nicu-dotnet depends on libc dynamic libraries at run time. If running within Docker, you may\nneed to install them, for example:\n\n```Dockerfile\nFROM mcr.microsoft.com/dotnet/aspnet:3.1\n\n# Install system dependencies.\nRUN apt-get update \\\n    \u0026\u0026 apt-get install -y \\\n        # icu.net dependency: libdl.so\n        libc6-dev \\\n     \u0026\u0026 rm -rf /var/lib/apt/lists/*\n\n...\n```\n\n## ICU versions\n\n### Linux\n\nicu-dotnet links with any installed version of ICU shared objects. It is\nrecommended to install the version provided by the distribution.  As of 2016,\nUbuntu Trusty uses version ICU 52 and Ubuntu Xenial 55.\n\nIf the version provided by the Linux distribution doesn't match your needs,\n[Microsoft's ICU package](https://www.nuget.org/packages/Microsoft.ICU.ICU4C.Runtime/)\nincludes builds for Linux.\n\n### Windows\n\nRather than using the full version of ICU (which can be ~25 MB), a custom minimum\nbuild can be used. It can be installed by the\n[Icu4c.Win.Min](https://www.nuget.org/packages/Icu4c.Win.Min/) nuget package.\nThe full version of ICU is also available as\n[Icu4c.Win.Full.Lib](https://www.nuget.org/packages/Icu4c.Win.Full.Lib/) and\n[Icu4c.Win.Full.Bin](https://www.nuget.org/packages/Icu4c.Win.Full.Bin/).\n\nMicrosoft also makes the full version available as\n[Microsoft.ICU.ICU4C.Runtime](https://www.nuget.org/packages/Microsoft.ICU.ICU4C.Runtime/).\n\n#### What's in the minimum build\n\n- Characters\n- ErrorCodes\n- Locale\n- Normalizer\n- Rules-based Collator\n- Unicode set to pattern conversions\n\n### macOS\n\nmacOS doesn't come preinstalled with all the normal icu4c libraries. They must be\ninstalled separately. One option is to use [MacPorts](https://www.macports.org/).\nThe [icu package on MacPorts](https://ports.macports.org/port/icu/) has the icu4c\nlibraries needed for icu.net to run properly.\n\nIf the icu4c libraries are not installed in a directory that is in the system path\nor your application directory, you will need to set an environment variable for\nthe OS to find them. For example:\n\n```bash\nexport DYLD_FALLBACK_LIBRARY_PATH=\"$HOME/lib:/usr/local/lib:/usr/lib:/opt/local/lib\"\n```\n\nIf you need to set environment variables like the above, consider adding them to\nyour `.zprofile` so you don't have to remember to do it manually.\n\n## Troubleshooting\n\n- make sure you added the nuget package `icu.net` and have native ICU libraries available.\n- the binaries of the nuget packages need to be copied to your output directory.\n  For `icu.net` this happens by the assembly reference that the package\n  adds to your project. The binaries of `Icu4c.Win.Min` are only relevant on\n  Windows. They will get copied by the `Icu4c.Win.Min.targets` file included\n  in the nuget package.\n\nOn Windows, the package installer should have added an import to the `*.csproj` file similar\nto the following:\n\n```xml\n\u003cImport Project=\"..\\..\\packages\\Icu4c.Win.Min.54.1.31\\build\\Icu4c.Win.Min.targets\"\n    Condition=\"Exists('..\\..\\packages\\Icu4c.Win.Min.54.1.31\\build\\Icu4c.Win.Min.targets')\" /\u003e\n```\n\n## Contributing\n\nWe love contributions! The library mainly contains the functionality we need for our products. If you\nmiss something that is part of ICU4C but not yet wrapped in icu.net, add it and create a pull request.\n\nIf you find a bug - create an [issue on GitHub](https://github.com/sillsdev/icu-dotnet/issues/new/choose),\nthen preferably fix it and create a pull request!\n","funding_links":["https://www.givedirect.org/donate/?cid=13536\u0026dd1=Language%20Software"],"categories":["Software"],"sub_categories":["Utilities"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsillsdev%2Ficu-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsillsdev%2Ficu-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsillsdev%2Ficu-dotnet/lists"}