Git Product home page Git Product logo

text.utf8.legacy's Introduction

Text.UTF8.Legacy

nuget nuget Build status Codacy Badge Codacy Badge

A package replacement for .Net Core 3.0+ UTF8 string encoding/decoding and windows-1252 codepage implementation to match .Net Framework behavior.

Description

As of .Net Core 3.0+ a bug was fixed in Microsoft's UTF8 implementation that changes the behavior of UTF8 string encoding and decoding. This package offers the legacy behavior that is still present in .Net Framework today for maximum compatibility when using .Net Core 3.0+. Also included is Windows-1252 codepage support which was made an optional package for .Net Core and no longer included.

Installation

Install Text.UTF8.Legacy from the Package Manager Console:

PM> Install-Package Text.UTF8.Legacy

Usage

UTF8 String decoding

using Text.UTF8.Legacy;

var bytes = // byte representation of a UTF8 string
var utf8String = Text.UTF8.Legacy.Encoding.UTF8.GetString(bytes);

UTF8 String encoding

using Text.UTF8.Legacy;

var string = "A test string";
var bytes = Text.UTF8.Legacy.Encoding.UTF8.GetBytes(string);

Encoding using Windows-1252 codepage encoding:

var string = "A test string";
var codepage1252Encoder = CodePagesEncodingProvider.Instance.GetEncoding(1252);
var bytes = codepage1252Encoder.GetBytes(string);

Compatibility

See .NET Core 3.0 follows Unicode best practices when replacing ill-formed UTF-8 byte sequences Issue Report

text.utf8.legacy's People

Contributors

replaysmike avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.