Code Monkey home page Code Monkey logo

Comments (12)

RReverser avatar RReverser commented on May 27, 2024 1

I mean in libgphoto2 itself :)

from gphoto2-rs.

maxicarlos08 avatar maxicarlos08 commented on May 27, 2024

I don't have much C experience (and less with the locales, only heard bad things about it), but isn't there a function like setlocale we can use to just set the locale to C to get consistent results regardless of the operating's system locale?

Sorry if what I'm saying makes no sense at all :/

from gphoto2-rs.

maxicarlos08 avatar maxicarlos08 commented on May 27, 2024

Wait nevermind, libgphoto2 already does that: https://github.com/gphoto/libgphoto2/blob/master/ChangeLog#L2249

from gphoto2-rs.

RReverser avatar RReverser commented on May 27, 2024

Yeah it does, as well as it has an internal function for overriding the encoding specifically. All I'm saying is that it's worth testing and adding whatever's necessary to make sure that Unicode strings from camera are correctly parsed and converted to UTF-8 that Rust expects regardless of LC_ALL=... environment variable or any other settings (I suspect right now if user sets LC_ALL to a non-UTF8 encoding, and there are non-ASCII strings, we'll get either corruption or runtime panics).

from gphoto2-rs.

RReverser avatar RReverser commented on May 27, 2024

If you have camera at hand and it allows settings some strings (e.g. Canon allows to set copyright author name via Digital Photo Professional), it would be good to set that to e.g. Chinese characters, overriding LC_ALL to some non-UTF8 encoding and checking how those characters are parsed by gphoto2-rs.

from gphoto2-rs.

maxicarlos08 avatar maxicarlos08 commented on May 27, 2024

I added an example to test this, unfortunately my camera (a Nikon D3400) does not seem to have any text that I can freely set.

If you have a camera where you can set a text, just adjust the CONFIG_KEY in the example to the widget name.

from gphoto2-rs.

RReverser avatar RReverser commented on May 27, 2024

I added an example to test this, unfortunately my camera (a Nikon D3400) does not seem to have any text that I can freely set.

It should have the same copyright field (https://www.dummies.com/article/home-auto-hobbies/photography/add-copyright-notice-images-nikon-d5600-245525/), but seems like it can be set only from the camera, which likely means no Unicode chars.

from gphoto2-rs.

RReverser avatar RReverser commented on May 27, 2024

Actually, one other thing you could do is just create a file with unicode chars via file manager when camera is connected, and then checking how it's reported via CameraFS?

from gphoto2-rs.

maxicarlos08 avatar maxicarlos08 commented on May 27, 2024

Actually, one other thing you could do is just create a file with unicode chars via file manager when camera is connected, and then checking how it's reported via CameraFS?

My camera sadly only exposes images to libgphoto2 it has taken and match the naming format :(

I suspect right now if user sets LC_ALL to a non-UTF8 encoding, and there are non-ASCII strings, we'll get either corruption or runtime panics

Will we? AFAICT we are using String::from_utf8_lossy wherever we get a string from libgphoto2, so invalid UTF-8 should not cause a pash

from gphoto2-rs.

RReverser avatar RReverser commented on May 27, 2024

so invalid UTF-8 should not cause a pash

Those I count as corruption :P

My camera sadly only exposes images to libgphoto2 it has taken and match the naming format :(

Hm, are you saying that manually added files via file manager are not visible via CameraFS? Fascinating.

from gphoto2-rs.

RReverser avatar RReverser commented on May 27, 2024

Anyway, I'll add some unicode chars to the virtual camera to make this easier to verify.

from gphoto2-rs.

maxicarlos08 avatar maxicarlos08 commented on May 27, 2024

Anyway, I'll add some unicode chars to the virtual camera to make this easier to verify.

WDYM? I haven't found any writable TextWidget on the Virtual camera. You don't seem to be able to create or upload files/directories on the virtual camera (the storage access type is RoDelete)

from gphoto2-rs.

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.