support utf8 and other encoding type #25
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thedo_embed()
function. This issue was caused by theparser.parse()
method in the_get_repo_functions()
functionTo 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:-en
or--encoding
argument to theparser.add_argument()
method._get_repo_functions()
function to open files usingopen(fp, 'r', encoding=encoding)
instead ofopen(fp, 'r')
.do_embed()
function to encode the file content usingfile_content.encode(encoding)
insteadThese changes should resolve the issue with UTF-8 encoded files and make the script more flexible