GithubHelp home page GithubHelp logo

assimp_utf8's Introduction

An exmaple for AssimpNet Issue #86

Motivation

Handle a filepath string as UTF-8.

.NET use Unicode as default, but Assimp expects UTF-8.

  • OriginalAssimpNetTests : use an original Assimp.AssimpContext (failure)
  • Utf8AssimpDllImportTests : use a modified AssimpContext_ImportFile_MarshalAs_LPUTF8Str (a cutout code of ImportFile)

In AssimpContext_ImportFile_MarshalAs_LPUTF8Str, use the same dll, but it specifies UnmanagedType.LPUTF8Str instead of UnmanagedType.LP8Str (passing string as UTF-8 to a DLL).

There are more I/O functions to fix and test.

Although what I need is that ImportWorks_For_Filename_Includes_Multibyte_MarshalAs_LPUTF8Str works fine.

Memo

This project is .NET6 (I'm sorry, this is for my environment circumstances).

Just 'OBJ' is test. I use Visual Studio 2022.

About TestFiles

TestFiles includes some OBJ model copied from assimp/test/models/OBJ/, and they are renamed with emoji. I choose emoji as a popular multibyte character for English people.

why 📁\Spider🕸️.obj is?

We usually aviod to use multibyte characters to filenames, but it is slipped in to folder names unintentionally (or as copied filename's postfix at local language).

A filename with emoji is a terrible one. I use it as a description.

Details of Tests

OriginalAssimpNetTests fails to handle a filename with multibyte characters

  • AssimpContextCouldNotImportFileWithMultibyteCharacters : a simple failure test.
  • ImportFileFromStreamIsNotAlsoAbleToHandleMultibyteCharacters : this shows ImportFileFromStream helps to import an OBJ file, but it could not help to import a MTL file inside a DLL.

Utf8AssimpDllImportTests

They mostly succeed.

One tes shows that could not handle Material name Terraindæk (æ was troubled). It's not my concern at present, but I keep it FYI, don't care it seriously (THIS_TEST_IS_CURRENTLY_FAILURE_because_MaterialName_is_incorrect_even_if_It_uses_MarshalAs_LPUTF8Str_FYI).

It might be including another problem about code pages (A Field Guide to Japanese Mojibake).

Screenshot: Expected Test Results in Test Explorer

Screenshot: Expected Test Results in Test Explorer

assimp_utf8's People

Contributors

emaame avatar

Watchers

 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.