You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I'm currently using the gpujpeg_image_load_from_file function to open images in a C++ project. However, I've encountered an issue when trying to open files that have special characters in their names, such as (((φ(◎ロ◎;)φ))).jpg.
It seems that the function uses char* for the file path parameter and relies on fopen internally, which does not handle file paths with special characters as I wish.
Is there another way to open this file, or would it be possible to update the gpujpeg_image_load_from_file function to handle file paths with special characters? (Maybe by using wide-character strings (wchar_t*) and _wfopen on Windows)
Regards,
Adrien
The text was updated successfully, but these errors were encountered:
thanks for reporting. I've tried with _wfopen, file name argument converted with MultiByteToWideChar with various codepages, CP_UTF8, CP_ACP - nothing worked.
Anyways, it seems like the value in argv is already incorrect, I've tried with 'φ' ("\xcf\x86" in UTF-8) and the particular argv[x] is single byte 0x66 ('f' in ASCII). I've tried also couple of other things like passing the value of phi to the function typed directly in code to C-str with MultiByteToWideChar(CP_UTF8,... conversion and _wfopen or without it (assuming multi-byte encoding to be understood by fopen). But without a success.
Is there another way to open this file,
You can of course open the file by yourself and read the data to a byte array - gpujpeg_decoder_decode() needs just the pointer to the buffer and its length. No need to use gpujpeg_image_load_from_file.
or would it be possible to update the gpujpeg_image_load_from_file function to handle file paths with special characters
I'd like to if i knew how to. I spent some time trying but without much success. So I cannot tell if I try any further.
Anyways, if you have some expertise or idea - could you make a minimal working example (POC) showing how to open such a file? Something like:
#include <cstdio>
int main(int argc, char *argv[]) {
wchar_t *filename;
// code to convert argv[1] to filename
FILE *f = _wfopen(filename, L"rb");
if (f) {
puts("success!");
}
}
(The string doesn't necessarily be passe from the command-line - if you write it to the code directly, I believe it will be OK as well, passing to gpujpeg_image_load_from_file is enough for you. This could be to work-around if there is some other problem passing the string from terminal.)
I am not sure if I don't have some problem with locales. So as a starting point to check if we both have the same situation, can you try?
and call it with φ as the argument? For me, it writes 1, which should not be the case unless you have Greek 8-bit encoding (I don't believe much of non-Greek 8b encodings have mapped the Greek alphabet)
Hello,
I'm currently using the
gpujpeg_image_load_from_file
function to open images in a C++ project. However, I've encountered an issue when trying to open files that have special characters in their names, such as(((φ(◎ロ◎;)φ))).jpg
.It seems that the function uses
char*
for the file path parameter and relies onfopen
internally, which does not handle file paths with special characters as I wish.Is there another way to open this file, or would it be possible to update the
gpujpeg_image_load_from_file
function to handle file paths with special characters? (Maybe by using wide-character strings (wchar_t*) and_wfopen
on Windows)Regards,
Adrien
The text was updated successfully, but these errors were encountered: