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

support utf8 and other encoding type #25

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bankThanabat
Copy link

@bankThanabat bankThanabat commented May 5, 2023

fix #24
This pull request adds support for an optional encoding type argument in the embed.py module. The previous version of the module did not properly handle UTF-8 encoded files when used with the do_embed() function. This issue was caused by the parser.parse() method in the _get_repo_functions() function

To resolve this issue, i added support for an optional encoding type argument using the -en or --encoding argument. Users can now specify an encoding type when running the script, and the script will use the specified encoding type when processing files. If no encoding type is specified, the default encoding type 'utf-8' will be used.

The following changes were made to the embed.py module:

  • Added the -en or --encoding argument to the parser.add_argument() method.
  • Modified the _get_repo_functions() function to open files using open(fp, 'r', encoding=encoding) instead of open(fp, 'r').
  • Modified the do_embed() function to encode the file content using file_content.encode(encoding) instead

These changes should resolve the issue with UTF-8 encoded files and make the script more flexible

@bankThanabat bankThanabat changed the title support utf8 and other encoding type support utf8 and other encoding type fixed#24 May 5, 2023
@bankThanabat bankThanabat changed the title support utf8 and other encoding type fixed#24 support utf8 and other encoding type May 5, 2023
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

Successfully merging this pull request may close these issues.

ut8 not supported
1 participant