Skip to content

Commit bcfda60

Browse files
authored
Fix/cp949 encoding error (#158)
* Avoid a cp949 encoding error. * Fix errors when loading opend multibyte characters codec file with json.
1 parent 4d1a717 commit bcfda60

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

jupyterlab_server/config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def get_federated_extensions(labextensions_path):
3333
# extensions are either top-level directories, or two-deep in @org directories
3434
for ext_path in chain(iglob(pjoin(ext_dir, '[!@]*', 'package.json')),
3535
iglob(pjoin(ext_dir, '@*', '*', 'package.json'))):
36-
with open(ext_path) as fid:
36+
with open(ext_path, encoding='utf-8') as fid:
3737
pkgdata = json.load(fid)
3838
if pkgdata['name'] not in federated_extensions:
3939
data = dict(
@@ -47,7 +47,7 @@ def get_federated_extensions(labextensions_path):
4747
)
4848
install_path = osp.join(osp.dirname(ext_path), 'install.json')
4949
if osp.exists(install_path):
50-
with open(install_path) as fid:
50+
with open(install_path, encoding='utf-8') as fid:
5151
data['install'] = json.load(fid)
5252
federated_extensions[data['name']] = data
5353
return federated_extensions
@@ -78,7 +78,7 @@ def get_page_config(labextensions_path, app_settings_dir=None, logger=None):
7878
if app_settings_dir:
7979
app_page_config = pjoin(app_settings_dir, 'page_config.json')
8080
if osp.exists(app_page_config):
81-
with open(app_page_config) as fid:
81+
with open(app_page_config, encoding='utf-8') as fid:
8282
data = json.load(fid)
8383

8484
# Convert lists to dicts
@@ -131,7 +131,7 @@ def get_page_config(labextensions_path, app_settings_dir=None, logger=None):
131131
app_dir = osp.dirname(app_settings_dir)
132132
package_data_file = pjoin(app_dir, 'static', 'package.json')
133133
if osp.exists(package_data_file):
134-
with open(package_data_file) as fid:
134+
with open(package_data_file, encoding='utf-8') as fid:
135135
app_data = json.load(fid)
136136
all_ext_data = app_data['jupyterlab'].get('extensionMetadata', {})
137137
for (ext, ext_data) in all_ext_data.items():

0 commit comments

Comments
 (0)