Subject: Re: Problems uploading files with non-English characters on Win 10
From: Ondřej Jirman
Date: Wed, 18 May 2022 20:25:37 +0200
Hi,

On Tue, May 17, 2022 at 02:37:38AM +0000, Terri wrote:
> Hi
> 
> Thanks for your reply. You replied: "Check what environment variables megacmd
> sets and set them, yourself in powershell before running megatools. That
> should help."
> 
> How do I check what environment variables megacmd sets? All I do in PowerShell
> when using megacmd is this:
> 
> Open a PowerShell console then type these commands in:
> Set-Alias megacmd "$env:LOCALAPPDATA\MEGAcmd\MEGAclient.exe"
> megacmd login "my@email.com" "mypassword"
> megacmd put "C:\Upload\Привет мир.txt"

I meant megacmd.bat in the megatools package. Anyway, it doesn't set anyhting
useful other than PATH.

Try this build: https://megous.com/dl/tmp/megatools-1.11.0-git-20220518-win64.zip

kind regards,
	o.

> and it just works. I don't need to do anything else in the console.
> 
> Thanks,Terri
> 
> ------- Original Message -------
> On Tuesday, May 17th, 2022 at 12:53 AM, Ondřej Jirman megatools@megous.com wrote:
> 
> > Hi,
> >
> > On Sun, May 15, 2022 at 08:21:23AM +0000, Terri wrote:
> >
> >> Hi,
> >>
> >> I think there might be a bug with megatools (experimental: megatools-1.11.0-git-20220401-win64) where it won't upload files that contain non-English characters. I'm using PowerShell on Windows 10 64-bit.
> >>
> >> For example, trying to upload this file C:\Upload\Привет мир.txt with:
> >>
> >> megatools put -u my@email.com -p mypassword "C:\Upload\Привет мир.txt" --path "/Root/" --reload
> >>
> >> This is the error message that I get:
> >>
> >> ERROR: Upload failed for 'C:\Upload\?????? ???.txt': Can't read local file C:\Upload\?????? ???.txt: Error opening file C:\Upload\?????? ???.txt: Invalid argument
> >>
> >> Changing the console input and output encoding to UTF-8 doesn't help either:
> >> [Console]::InputEncoding = [Console]::OutputEncoding = New-Object System.Text.UTF8Encoding
> >>
> >> The same thing happens in command prompt as well.
> >>
> >> However, it does work ok with megacmd in PowerShell, the displayed text in the PowerShell console might be messed up, but the file is still uploaded with the correct characters nonetheless.
> >>
> >> Any assistance would be much appreciated.
> >
> > Check what environment variables megacmd sets and set them, yourself in
> > powershell before running megatools. That should help.
> >
> > kind regards,
> > o.
> >
> >> Thanks,
> >> T