On windows when analyze wants to save the results into a json file it throws and encoding error because its not using the right encoding
To Reproduce
Steps to reproduce the behavior:
Go to the chasten repository and enter the venv
run the command 'chasten analyze chasten --config $PWD/.chasten/ --search-path . --save-directory chasten --save'
It then results in this
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ C:\Users\Preston\CMPSC-203\ChastenProject\chasten\chasten\main.py:662 in analyze │
│ │
│ 659 │ # display all of the analysis results if verbose output is requested │
│ 660 │ output.print_analysis_details(chasten_results_save, verbose=verbose) │
│ 661 │ # save all of the results from this analysis │
│ ❱ 662 │ saved_file_name = filesystem.write_chasten_results( │
│ 663 │ │ output_directory, project, chasten_results_save, save │
│ 664 │ ) │
│ 665 │ # output the name of the saved file if saving successfully took place │
│ │
│ C:\Users\Preston\CMPSC-203\ChastenProject\chasten\chasten\filesystem.py:198 in │
│ write_chasten_results │
│ │
│ 195 │ │ results_path_with_file = results_path / complete_results_file_name │
│ 196 │ │ results_json = results_content.model_dump_json(indent=2) │
│ 197 │ │ # use the built-in method with pathlib Path to write the JSON contents │
│ ❱ 198 │ │ results_path_with_file.write_text(results_json) │
│ 199 │ │ │
│ 200 │ │ # return the name of the created file for diagnostic purposes │
│ 201 │ │ return complete_results_file_name │
│ │
│ C:\Users\Preston\AppData\Local\Programs\Python\Python311\Lib\pathlib.py:1079 in write_text │
│ │
│ 1076 │ │ │ │ │ │ │ data.__class__.__name__) │
│ 1077 │ │ encoding = io.text_encoding(encoding) │
│ 1078 │ │ with self.open(mode='w', encoding=encoding, errors=errors, newline=newline) as f │
│ ❱ 1079 │ │ │ return f.write(data) │
│ 1080 │ │
│ 1081 │ def readlink(self): │
│ 1082 │ │ """ │
│ │
│ C:\Users\Preston\AppData\Local\Programs\Python\Python311\Lib\encodings\cp1252.py:19 in encode │
│ │
│ 16 │
│ 17 class IncrementalEncoder(codecs.IncrementalEncoder): │
│ 18 │ def encode(self, input, final=False): │
│ ❱ 19 │ │ return codecs.charmap_encode(input,self.errors,encoding_table)[0] │
│ 20 │
│ 21 class IncrementalDecoder(codecs.IncrementalDecoder): │
│ 22 │ def decode(self, input, final=False): │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f680' in position 34312: character maps to <undefined>
This should not throw an error at all and shouldn't have issues with encoding when there are special characters.
I believe this is only an issue on windows because this was an issue with running the workflow and getting it to pass on
windows other platforms don't seem to have this issue.
On windows when analyze wants to save the results into a json file it throws and encoding error because its not using the right encoding
To Reproduce Steps to reproduce the behavior:
It then results in this
This should not throw an error at all and shouldn't have issues with encoding when there are special characters. I believe this is only an issue on windows because this was an issue with running the workflow and getting it to pass on windows other platforms don't seem to have this issue.