Some regions use unicode characters in the strings in region.json, some which end up getting used in the Jinja templates and written to index.html. Encoding the contents of the template variable as utf-8 before writing it ensures that the file writer won't fail on unicode characters.
Demo
$ python build.py dr-region --framework-branch cpc/fix-unicodes
Cloning dr-region_config@HEAD...
Attempting to checkout the development branch
Branch 'development' set up to track remote branch 'development' from 'origin' by rebasing.
Cloning GeositeFramework@HEAD...
Attempting to checkout the cpc/fix-unicodes branch
Branch 'cpc/fix-unicodes' set up to track remote branch 'cpc/fix-unicodes' from 'origin' by rebasing.
Cloning GeositeFramework/src/plugins/regional-planning@HEAD...
Attempting to checkout the development branch
Branch 'development' set up to track remote branch 'development' from 'origin' by rebasing.
Copying region.json...
Copying partners.html...
Copying Proxy.config...
Failed to copy Proxy.config file. [Errno 2] No such file or directory: 'Proxy.config'. Proxy.config is optional, skipping.
Copying plugins...
Copying img...
Copying Views...
Copying methods...
Copying sims...
Failed to copy sims directory. cannot copy tree 'sims': not a directory. sims is optional, skipping.
Copying xml...
Copying docs...
Failed to copy docs directory. cannot copy tree 'docs': not a directory. docs is optional, skipping.
Copying locales...
Failed to copy locales directory. cannot copy tree 'locales': not a directory. locales is optional, skipping.
INFO:root:Updating python dependencies...
...
---------------------------------------
CoastalResilienceNetwork/dr-region was built successfully
---------------------------------------
Testing Instructions
Try building the dr-region or nctemp-region using the feature/task-1 branch. They should error out with an error related to unicode.
Try building them again with this branch. They should succeed.
Try building any other region with this branch. It should also succeed like normal.
Overview
Some regions use unicode characters in the strings in
region.json
, some which end up getting used in the Jinja templates and written to index.html. Encoding the contents of the template variable as utf-8 before writing it ensures that the file writer won't fail on unicode characters.Demo
Testing Instructions
dr-region
ornctemp-region
using thefeature/task-1
branch. They should error out with an error related to unicode.