CoastalResilienceNetwork / GeositeFramework

Mapping Framework powering TNC Coastal Resilience programs
http://maps.coastalresilience.org/network/
GNU General Public License v3.0
13 stars 10 forks source link

Write index file in utf-8 #1160

Closed caseycesari closed 5 years ago

caseycesari commented 5 years ago

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

$ 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

caseycesari commented 5 years ago

Thanks!