Skip to content

Commit c348170

Browse files
Fixing encoding issues by making the code utf-8 encoded (Fixes #40)
1 parent 2539f0e commit c348170

11 files changed

+17
-6
lines changed

github_release.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env python2.7
2+
# -*- coding: utf-8 -*-
23

34
from __future__ import print_function
45

@@ -370,7 +371,7 @@ def patch_release(repo_name, current_tag_name, **values):
370371
response = _request(
371372
'PATCH', url,
372373
data=json.dumps(data),
373-
headers={'Content-Type': 'application/json'})
374+
headers={'Content-Type': 'application/json; charset=utf-8'})
374375
response.raise_for_status()
375376

376377
# In case a new tag name was provided, remove the old one.
@@ -456,7 +457,7 @@ def gh_release_create(repo_name, tag_name, asset_pattern=None, name=None,
456457
response = _request(
457458
'POST', GITHUB_API + '/repos/{0}/releases'.format(repo_name),
458459
data=json.dumps(data),
459-
headers={'Content-Type': 'application/json'})
460+
headers={'Content-Type': 'application/json; charset=utf-8'})
460461
response.raise_for_status()
461462
print_release_info(response.json(),
462463
title="created '%s' release" % tag_name)
@@ -983,7 +984,7 @@ def gh_ref_create(repo_name, reference, sha):
983984
response = _request(
984985
'POST', GITHUB_API + '/repos/{0}/git/refs'.format(repo_name),
985986
data=json.dumps(data),
986-
headers={'Content-Type': 'application/json'})
987+
headers={'Content-Type': 'application/json; charset=utf-8'})
987988
response.raise_for_status()
988989
print_ref_info(response.json())
989990

tests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12

23
import datetime as dt
34
import errno

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12

23
import os
34

tests/test_cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12

23
import pytest
34

@@ -50,7 +51,7 @@
5051
([], "release", "edit", ["1.0.0", "--tag-name", "new_tag",
5152
"--target-commitish", "1234567",
5253
"--name", "new_name",
53-
"--body", "new_body"]),
54+
"--body", u"new_body with utf-8 char …"]),
5455
([], "release", "delete", ["1.0.0"]),
5556
([], "release", "delete", ["*a", "--keep-pattern", "1*"]),
5657
([], "release", "publish", ["1.0.0"]),

tests/test_distribution.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12

23
import pytest
34

tests/test_integration_asset.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12

23
from . import (
34
check_releases,

tests/test_integration_commit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12

23
from . import (
34
do_commit,

tests/test_integration_ref.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12

23
from . import (
34
do_commit,

tests/test_integration_release_create.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12

23
from . import (
34
check_releases,

tests/test_integration_release_delete.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12

23
from . import (
34
check_releases,

0 commit comments

Comments
 (0)