UTF8 Encode file output

This commit is contained in:
Miguel Nogueira 2019-06-12 15:39:17 +01:00
parent fbd0c39073
commit 2aec871c0e
2 changed files with 16 additions and 12 deletions

View File

@ -1,10 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="e692128d-c507-4123-b92b-96e6e5af92d3" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pyvpn" beforeDir="false" afterPath="$PROJECT_DIR$/pyvpn" afterDir="false" />
</list>
<list default="true" id="e692128d-c507-4123-b92b-96e6e5af92d3" name="Default Changelist" comment="" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -28,8 +25,8 @@
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/pyvpn">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="26" column="25" selection-start-line="26" selection-start-column="25" selection-end-line="26" selection-end-column="25" />
<state relative-caret-position="335">
<caret line="30" column="28" lean-forward="true" selection-start-line="30" selection-start-column="28" selection-end-line="30" selection-end-column="28" />
</state>
</provider>
</entry>
@ -133,7 +130,14 @@
<option name="project" value="LOCAL" />
<updated>1560287808394</updated>
</task>
<option name="localTasksCounter" value="4" />
<task id="LOCAL-00004" summary="Tweak expectations">
<created>1560347298258</created>
<option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" />
<updated>1560347298258</updated>
</task>
<option name="localTasksCounter" value="5" />
<servers />
</component>
<component name="ToolWindowManager">
@ -163,7 +167,8 @@
<MESSAGE value="First commit. &#10;Untested, following commits will be fixes." />
<MESSAGE value="Add Readme and License.&#10;Testing ensues." />
<MESSAGE value="Make process path dynamic" />
<option name="LAST_COMMIT_MESSAGE" value="Make process path dynamic" />
<MESSAGE value="Tweak expectations" />
<option name="LAST_COMMIT_MESSAGE" value="Tweak expectations" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/venv/lib/python3.6/site-packages/pexpect/spawnbase.py">
@ -227,8 +232,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/pyvpn">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="26" column="25" selection-start-line="26" selection-start-column="25" selection-end-line="26" selection-end-column="25" />
<state relative-caret-position="335">
<caret line="30" column="28" lean-forward="true" selection-start-line="30" selection-start-column="28" selection-end-line="30" selection-end-column="28" />
</state>
</provider>
</entry>

3
pyvpn
View File

@ -31,12 +31,11 @@ if len(sys.argv) > 2:
fScript.sendline(clientName)
fScript.expect(pexpect.EOF)
if os.path.exists(configFilePath):
file = open(configFilePath, 'r')
finalResult = base64.b64encode(file.read())
finalResult = base64.b64encode(file.read().encode("utf-8"))
sys.stdout.write(finalResult)
sys.stdout.flush()