Git Product home page Git Product logo

Comments (2)

davidben avatar davidben commented on July 21, 2024 1

It sounds like there are a few points of confusion here:

First, a UniversalString carries UTF-32, not UTF-16.

Second, using a char16_t or char32_t output would actually be forbidden (undefined behavior) in C and C++. There is no guarantee that the UniversalString payload is correctly aligned for a char32_t, to say nothing of strict aliasing requirements. Even setting those requirements aside, UniversalString stores in big-endian, and most machines are little-endian these days.

Rather, the correct way to decode a UniversalString payload is to pass the byte output into a UTF-32BE decoder. Such a decoder is a mostly a trivially loading 4-byte big-endian words, though there are some checks it should do for whether each codepoint is valid. None of that is done by ASN1_get_object because ASN1_get_object's job is to just parse an individual TLV, leaving the caller to interpret the contents.

from openssl.

FdaSilvaYY avatar FdaSilvaYY commented on July 21, 2024

A good resource about Unicode, UTF-8 and co :

https://tonsky.me/blog/unicode/

Derived from an old article, I read 20 years ago

from openssl.

Related Issues (20)

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.