Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source sequence is illegal/malformed utf-8 #284

Open
ravimartins opened this issue May 21, 2021 · 8 comments
Open

Source sequence is illegal/malformed utf-8 #284

ravimartins opened this issue May 21, 2021 · 8 comments

Comments

@ravimartins
Copy link

Hello guys,

I'm getting the following error when I try to deploy to my EC2 Instances. I have others applications, with the same structure, that is working perfectly.

I got this on codedeploy-agent-log:

[Aws::CodeDeployCommand::Client 200 0.078138 0 retries] put_host_command_complete(command_status:"Failed",diagnostics:{format:"JSON",payload:"{"error_code":5,"script_name":"","message":"source sequence is illegal/malformed utf-8","log":""}"}

Someone knows what is happening?

@janusz-mw
Copy link

I have the same issue. I'm using EC2 Windows machine.

I suspect that the error is caused by some diacritics in the file names, but didn't confirm that yet.

@kedde
Copy link

kedde commented Jun 23, 2021

I had a similar issue running an ec2 instance where I had the danish letter 'ø' in one of the filenames

/aws-codedeploy-agent/lib/instance_agent/plugins/codedeploy/install_instruction.rb:169:in to_json': source sequence is illegal/malformed utf-8 (JSON::GeneratorError) from D:/git/aws-codedeploy-agent/lib/instance_agent/plugins/codedeploy/install_instruction.rb:169:in to_json'
from D:/git/aws-codedeploy-agent/lib/instance_agent/plugins/codedeploy/installer.rb:45:in block in install' from D:/git/aws-codedeploy-agent/lib/instance_agent/plugins/codedeploy/installer.rb:44:in open'
from D:/git/aws-codedeploy-agent/lib/instance_agent/plugins/codedeploy/installer.rb:44:in install' from D:/git/aws-codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_executor.rb:144:in block in class:CommandExecutor'
from D:/git/aws-codedeploy-agent/lib/instance_agent/plugins/codedeploy/command_executor.rb:72:in execute_command' from D:/git/aws-codedeploy-agent/lib/aws/codedeploy/local/deployer.rb:86:in block in execute_events'
from D:/git/aws-codedeploy-agent/lib/aws/codedeploy/local/deployer.rb:85:in each' from D:/git/aws-codedeploy-agent/lib/aws/codedeploy/local/deployer.rb:85:in execute_events'
from D:/git/aws-codedeploy-agent/bin/codedeploy-local:129:in `

'

I found that encoding was set to IBM437

irb
irb(main):001:0> ENCODING
=> #Encoding:IBM437

To solve the problem I ticked this box
image

irb
irb(main):001:0> ENCODING
=> #Encoding:UTF-8

Maybe a possible solution to this in the code could be to force utf-8 encoding?

@janusz-mw
Copy link

@kedde thanks. Checking this box solves the issue.

@MartinHeynAndersen
Copy link

We have the same issue when trying to deploy our server package. Multiple files in the package is containg dainsh chars and we are unable to rename these files. We are deploying to a Windows server 2016 instance.
The workaround with activating the feature "BETA: Use unicode UTF-8 for world wide language support" does not seem like a viable solution for us.

@mwjones-aws
Copy link
Contributor

What is your operating system level locale setting?

@MartinHeynAndersen
Copy link

MartinHeynAndersen commented Dec 15, 2022 via email

@t0shiii
Copy link
Contributor

t0shiii commented Dec 21, 2022

@MartinHeynAndersen we will work on reproducing this issue and get back to you.

@t0shiii t0shiii reopened this Dec 21, 2022
@jeremy-caylent
Copy link

jeremy-caylent commented May 9, 2023

Hi everyone,

So i ran into this issue recently.

The reason for the issue was some spanish characters in the application code.
Try using the following command to search your application source repo to find any issues:

find . | perl -ne 'print if /[^[:ascii:]]/'

After updating those file names, it worked correctly.

I did use the windows language settings UTF fix temporally until the underlying fix was applied.
This can be done via powershell like so:

Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Nls\CodePage" -Name "ACP" -Value '65001' -Type String
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Nls\CodePage" -Name "OEMCP" -Value '65001' -Type String
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Nls\CodePage" -Name "MACCP" -Value '65001' -Type String

reboot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants