UX: check for BOM or other encoding issues in input files (SAM/CFN template.yaml, ...)
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 807
- Avg merge
- 10h 12m
- Merged PRs (30d)
- 7
Description
_this is a followup to #2613_
## Problem
Unexpected encoding or BOM (byte order mark) in input files can fail but it's not obvious to customers what action to take.
## Solution
Toolkit can do one or more of :
1. try to ingest the file using different encodings
2. try to remove BOM before ingestion
3. detect the issue and surface advice such as "the file has a BOM, save it as utf-8 (without BOM) then try again"
> > So it seems maybe it does find the file if using a correct path because I get a different error? 🤷♂️
>
> Yup I think so too. I also tried a few different `payload` paths on my Windows PC and they all worked correctly. So it may be something with your specific setup. This would be a lot easier to figure out if we didn't swallow the error but until a fix goes out we have to resort to trial-and-error. Things to try:
> * Make sure VS Code is opened as administrator
> * Check the encoding of the JSON file. Is it `UTF-8`?
> * Check the first 3 bytes of the file with `Get-Content -Path PATH_HERE -Encoding byte -TotalCount 3` (PowerShell 5). If it shows `239 187 191` then there is a BOM. Try saving without the BOM by changing the encoding in VS Code to just normal `UTF-8`:
> 
Contributor guide
Research direction
The issue names SAM/CFN template.yaml and a JSON input file; begin by reproducing the encoding failure and checking the first three bytes with the listed PowerShell command. Compare the proposed approaches and define done as reliably detecting or handling BOM/encoding problems while surfacing actionable guidance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cloud, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100