fix mastodon post encoding
This commit is contained in:
parent
27a4b1a094
commit
a7ef35cb0f
1 changed files with 3 additions and 1 deletions
|
|
@ -5,10 +5,12 @@ from django.db import transaction
|
||||||
from mastodon import Mastodon
|
from mastodon import Mastodon
|
||||||
from .models import GovernmentPlanUpdate, GovernmentPlan
|
from .models import GovernmentPlanUpdate, GovernmentPlan
|
||||||
import re
|
import re
|
||||||
|
import html
|
||||||
|
|
||||||
def strip_html_tags(text):
|
def strip_html_tags(text):
|
||||||
tag_re = re.compile(r'<[^>]+>')
|
tag_re = re.compile(r'<[^>]+>')
|
||||||
return tag_re.sub('', text).decode('utf-8')
|
plain_text = tag_re.sub('', text)
|
||||||
|
return html.unescape(plain_text)
|
||||||
|
|
||||||
def post_to_mastodon(text):
|
def post_to_mastodon(text):
|
||||||
mastodon = Mastodon(
|
mastodon = Mastodon(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue