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

[BUG] UnicodeEncodeError: 'charmap' codec can't encode character '\ufeff' in position 0: character maps to <undefined> #127

Closed
ztrhgf opened this issue Sep 19, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@ztrhgf
Copy link

ztrhgf commented Sep 19, 2023

Describe the bug
When running:
IntuneCD-startbackup --mode=1 --output=json --path="$PWD\prod-backup" --localauth="$PWD\auth.json"

Backup fails with error:

Backing up Proactive Remediation: BIOS_UEFI_Boot_Path
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\WDAGUtilityAccount\AppData\Local\Programs\Python\Python311\Scripts\IntuneCD-startbackup.exe\__main__.py", line 7, in <module>
  File "C:\Users\WDAGUtilityAccount\AppData\Local\Programs\Python\Python311\Lib\site-packages\IntuneCD\run_backup.py", line 370, in start
    run_backup(args.path, args.output, exclude, token)
  File "C:\Users\WDAGUtilityAccount\AppData\Local\Programs\Python\Python311\Lib\site-packages\IntuneCD\run_backup.py", line 275, in run_backup
    results.append(savebackup(path, output, exclude, token))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\WDAGUtilityAccount\AppData\Local\Programs\Python\Python311\Lib\site-packages\IntuneCD\backup_proactiveRemediation.py", line 78, in savebackup
    f.write(decoded)
  File "C:\Users\WDAGUtilityAccount\AppData\Local\Programs\Python\Python311\Lib\encodings\cp1250.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'charmap' codec can't encode character '\ufeff' in position 0: character maps to <undefined>

To Reproduce
Upload "UTF8 with BOM" encoded remediation or detection script to Intune and run backup action.

Expected behavior
Backup "UTF8 with BOM" encoded scripts successfully.

Screenshots
If applicable, add screenshots to help explain your problem.

Run type (please complete the following information):

  • Mode: 1
  • Client: local machine
  • Version latest

Additional context
Add any other context about the problem here.

@ztrhgf ztrhgf added the bug Something isn't working label Sep 19, 2023
@almenscorner
Copy link
Owner

@ztrhgf
Copy link
Author

ztrhgf commented Sep 19, 2023

Same goes for builtin PowerShell Intune script "Modern Workplace - Autopatch Client Setup v1.1" that is being created automatically when Autopatch feature is used.

@ztrhgf
Copy link
Author

ztrhgf commented Sep 19, 2023

It helped thanks!

@ztrhgf ztrhgf closed this as completed Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants