Subject:
From: Ondřej Jirman
Date: Tue, 3 Mar 2020 18:06:39 +0100
On Tue, Mar 03, 2020 at 08:22:11AM -0800, Ethan Dalool wrote:
> Hi, Ondřej. Thanks for your very fast response.
> 
> Your link says:
> 
> > This is just a cosmetic issue. Internally, megatools always work with UTF-8
> file names, and even if the tool's terminal output is corrupted, files names
> of downloaded/uploaded files will be correct.
> 
> But the reason I sent this email is specifically because the files are failing
> to upload. It's not just a cosmetic issue. Please see my error message again.
> 
> I don’t program in C++, but I know from Python experience that attempting to
> `open()` a filename that contains invalid characters yields the OS exception
> "Invalid argument". So when I see megatools displaying questionmark filenames,
> even when I'm using Powershell which capable of displaying UTF-8, and the
> "Cannot open file: Invalid Argument" exception, it makes me suspicious.

Hello,

none of the powershell stuff matters. The input/output from megatools is handled
by glib library, which does utf8->something conversion when printing to the
stdout and something->utf8 conversion when taking command line filename type
arguments.

Glib uses some environment variables to decide what that something will be.
You need to have these environment variables set even under powershell,
otherwise glib will cause a mess.

You can read about it here: https://developer.gnome.org/glib/stable/glib-Character-Set-Conversion.html

regards,
	o.

> -----Original Message-----
> From: Ondřej Jirman <megatools@megous.com> 
> Sent: Tuesday, March 3, 2020 3:12 AM
> To: Ethan Dalool <ethan@voussoir.net>
> Subject: Re: 1.10.2 on Windows, megaput files with unicode names = error opening file
> 
> Hello,
> 
> On Tue, Mar 03, 2020 at 12:42:48AM -0800, Ethan Dalool wrote:
> > Hi,
> > 
> >  
> > 
> > First of all, thank you for megatools. I think it's the best software 
> > of its kind for interacting with mega.
> > 
> 
> I'm glad megatools works for you.
> 
> > 
> > I'm having some trouble using megaput to upload files with Unicode 
> > characters in the filename. It gives me this error:
> > 
> >  
> > 
> > > D:\software\megatools\1.10.2\megaput.exe --config mega.ini
> > "C:\outbox\ ȳ  ϼ   .zip"
> > 
> >  
> > 
> > ERROR: Upload failed for 'C:\outbox\?????.zip': Can't read local file
> > C:\outbox\?????.zip: Error opening file C:\outbox\?????.zip: Invalid 
> > argument
> > 
> 
> https://megous.com/git/megatools/tree/README#n80
> 
> does this help?
> 
> regards,
> 	o.
> 
> > 
> > I notice that the Unicode characters are being replaced by ? even 
> > though Powershell is capable of displaying them, which leads me to 
> > believe that somewhere internally, megaput is escaping the filename, 
> > converting out-of- page characters to ? prior to upload, and then 
> > choking on it. I know that many programs do this kind of escaping for 
> > display purposes but clearly this escaped name shouldn't be going to the upload routine.
> > 
> >  
> > 
> > I hope this issue will be simple to resolve, and if I can provide 
> > anything else to make it easier please let me know.
> > 
> >  
> > 
> > Thanks
> > 
>