Coder Social home page Coder Social logo

UTF-8 string conversion methods about jni-bind HOT 2 OPEN

google avatar google commented on August 25, 2024
UTF-8 string conversion methods

from jni-bind.

Comments (2)

jwhpryor avatar jwhpryor commented on August 25, 2024

Ok, you're specifically referring to UTF8 correct?

If so, could you update the bug title to reflect that? I assume you're aware that there are already string conversions for existing char*, std::string etc.

from jni-bind.

jwhpryor avatar jwhpryor commented on August 25, 2024

So, I took a pass through your conversion code, and had a chance to think a bit on this myself.

I think your conversion may be simple a subset of the behaviour LocalString already supports.

The former case is a function that takes in a std::string and performs a conversion to UTF16 from UTF8. I believe just using a regular ctor is equivalent?

The latter converts from a UTF16 string to a regular std::string, however, LocalString just directly asks for a UTF8 string, so you're probably just making your conversion explicit, or making an unnecessary one (I don't know what the JVM does internally).

That said, in C++20, UTF16 has its own view std::filesystem::path::u16string. Here, calling GetUtfString could actually be efficiently represented. So, I think this should be revisited when C++20 support is added, but I think your conversion methods are already covered.

from jni-bind.

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.