diff --git a/CHANGES b/CHANGES
index eb3dc23..4fe065e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,7 +1,7 @@
 Bleach changes
 ==============
 
-Version 3.0.3 (In development)
+Version 3.1.0 (In development)
 ------------------------------
 
 **Security fixes**
@@ -25,6 +25,12 @@ None
 * Fix cases where attribute names could have invalid characters in them.
   (#419)
 
+* Fix problems with ``LinkifyFilter`` not being able to match links
+  across ``&amp;``. (#422)
+
+* Fix ``InputStreamWithMemory`` when the ``BleachHTMLParser`` is
+  parsing ``meta`` tags. (#431)
+
 
 Version 3.0.2 (October 11th, 2018)
 ----------------------------------
diff --git a/bleach/__init__.py b/bleach/__init__.py
index a6445d0..6249bf8 100644
--- a/bleach/__init__.py
+++ b/bleach/__init__.py
@@ -20,7 +20,7 @@ from bleach.sanitizer import (
 # yyyymmdd
 __releasedate__ = ''
 # x.y.z or x.y.z.dev0 -- semver
-__version__ = '3.0.3.dev0'
+__version__ = '3.1.0.dev0'
 VERSION = parse_version(__version__)
 
 
diff --git a/bleach/html5lib_shim.py b/bleach/html5lib_shim.py
index 8887667..25e3e95 100644
--- a/bleach/html5lib_shim.py
+++ b/bleach/html5lib_shim.py
@@ -181,6 +181,14 @@ class InputStreamWithMemory(object):
     def errors(self):
         return self._inner_stream.errors
 
+    @property
+    def charEncoding(self):
+        return self._inner_stream.charEncoding
+
+    @property
+    def changeEncoding(self):
+        return self._inner_stream.changeEncoding
+
     def char(self):
         c = self._inner_stream.char()
         # char() can return None if EOF, so ignore that

diff --git a/tests/test_html5lib_shim.py b/tests/test_html5lib_shim.py
index 5712d33..ce15de7 100644
--- a/tests/test_html5lib_shim.py
+++ b/tests/test_html5lib_shim.py
@@ -80,3 +80,65 @@ def test_serializer(data, expected):
     serialized = serializer.render(walker(dom))
 
     assert serialized == expected
+
+
+@pytest.mark.parametrize('parser_args, data, expected', [
+    # Make sure InputStreamWithMemory has charEncoding and changeEncoding
+    (
+        {},
+        '<meta charset="utf-8">',
+        '<meta charset="utf-8">'
+    ),
+    # Handle consume entities False--all entities are passed along and then
+    # escaped when serialized
+    (
+        {'consume_entities': False},
+        'text &amp;&gt;&quot;',
+        'text &amp;amp;&amp;gt;&amp;quot;'
+    ),
+    # Handle consume entities True--all entities are consumed and converted
+    # to their character equivalents and then &, <, and > are escaped when
+    # serialized
+    (
+        {'consume_entities': True},
+        'text &amp;&gt;&quot;',
+        'text &amp;&gt;"'
+    ),
+    # Test that "invalid-character-in-attribute-name" errors in tokenizing
+    # result in attributes with invalid names getting dropped
+    (
+        {},
+        '<a href="http://example.com"">',
+        '<a href="http://example.com"></a>'
+    ),
+    (
+        {},
+        '<a href=\'http://example.com\'\'>',
+        '<a href="http://example.com"></a>'
+    )
+])
+def test_bleach_html_parser(parser_args, data, expected):
+    args = {
+        'tags': None,
+        'strip': True,
+        'consume_entities': True
+    }
+    args.update(parser_args)
+
+    # Build a parser, walker, and serializer just like we do in clean()
+    parser = html5lib_shim.BleachHTMLParser(**args)
+    walker = html5lib_shim.getTreeWalker('etree')
+    serializer = html5lib_shim.BleachHTMLSerializer(
+        quote_attr_values='always',
+        omit_optional_tags=False,
+        escape_lt_in_attrs=True,
+        resolve_entities=False,
+        sanitize=False,
+        alphabetical_attributes=False,
+    )
+
+    # Parse, walk, and then serialize the output
+    dom = parser.parseFragment(data)
+    serialized = serializer.render(walker(dom))
+
+    assert serialized == expected
diff --git a/tests/test_linkify.py b/tests/test_linkify.py
index ab1c513..f121189 100644
--- a/tests/test_linkify.py
+++ b/tests/test_linkify.py
@@ -69,17 +69,6 @@ def test_mangle_text():
     )
 
 
-def test_invalid_attribute_names():
-    """Test that "invalid-character-in-attribute-name" errors in tokenizing
-    result in attributes with invalid names get dropped.
-
-    """
-    assert (
-        linkify('<a href="http://example.com/"">') ==
-        '<a href="http://example.com/" rel="nofollow"></a>'
-    )
-
-
 @pytest.mark.parametrize('data,parse_email,expected', [
     (
         'a james@example.com mailto',

AttributeError: 'InputStreamWithMemory' object has no attribute 'charEncoding'
Using this code:

```
import bleach

TEXT = """\
<html>
<head>
    <meta charset="utf-8">
</head>
<body>
</body>
</html>
"""
print(bleach.clean(TEXT, tags=['html', 'head', 'meta', 'body']))
```

we get this traceback:

```
Traceback (most recent call last):
  File "s.py", line 12, in <module>
    print(bleach.clean(TEXT, tags=['html', 'head', 'meta', 'body']))
  File "/home/willkg/mozilla/bleach/bleach/__init__.py", line 84, in clean
    return cleaner.clean(text)
  File "/home/willkg/mozilla/bleach/bleach/sanitizer.py", line 169, in clean
    dom = self.parser.parseFragment(text)
  File "/home/willkg/mozilla/bleach/bleach/_vendor/html5lib/html5parser.py", line 317, in parseFragment
    self._parse(stream, True, *args, **kwargs)
  File "/home/willkg/mozilla/bleach/bleach/html5lib_shim.py", line 385, in _parse
    self.mainLoop()
  File "/home/willkg/mozilla/bleach/bleach/_vendor/html5lib/html5parser.py", line 241, in mainLoop
    new_token = phase.processStartTag(new_token)
  File "/home/willkg/mozilla/bleach/bleach/_vendor/html5lib/html5parser.py", line 472, in processStartTag
    return self.startTagHandler[token["name"]](token)
  File "/home/willkg/mozilla/bleach/bleach/_vendor/html5lib/html5parser.py", line 1067, in startTagProcessInHead
    return self.parser.phases["inHead"].processStartTag(token)
  File "/home/willkg/mozilla/bleach/bleach/_vendor/html5lib/html5parser.py", line 472, in processStartTag
    return self.startTagHandler[token["name"]](token)
  File "/home/willkg/mozilla/bleach/bleach/_vendor/html5lib/html5parser.py", line 745, in startTagMeta
    if self.parser.tokenizer.stream.charEncoding[1] == "tentative":
AttributeError: 'InputStreamWithMemory' object has no attribute 'charEncoding'
```

This is with Bleach from master tip (3.0.3.dev0) and Python 2.7.15.

This issue covers fixing that.
tests/test_html5lib_shim.py::test_bleach_html_parser[parser_args0-<meta
tests/test_html5lib_shim.py::test_convert_entities[-] tests/test_html5lib_shim.py::test_convert_entities[abc-abc] tests/test_html5lib_shim.py::test_convert_entities[&nbsp;-\xa0] tests/test_html5lib_shim.py::test_convert_entities[&#32;- tests/test_html5lib_shim.py::test_convert_entities[&#x20;- tests/test_html5lib_shim.py::test_convert_entities[&xx;-&xx;] tests/test_html5lib_shim.py::test_convert_entities[this tests/test_html5lib_shim.py::test_serializer[-] tests/test_html5lib_shim.py::test_serializer[text-text] tests/test_html5lib_shim.py::test_serializer[&-&amp;] tests/test_html5lib_shim.py::test_serializer[a tests/test_html5lib_shim.py::test_serializer[<a tests/test_html5lib_shim.py::test_bleach_html_parser[parser_args1-text tests/test_html5lib_shim.py::test_bleach_html_parser[parser_args2-text tests/test_html5lib_shim.py::test_bleach_html_parser[parser_args3-<a tests/test_html5lib_shim.py::test_bleach_html_parser[parser_args4-<a tests/test_linkify.py::test_empty tests/test_linkify.py::test_simple_link tests/test_linkify.py::test_trailing_slash tests/test_linkify.py::test_mangle_link tests/test_linkify.py::test_mangle_text tests/test_linkify.py::test_email_link[a tests/test_linkify.py::test_email_link[aussie tests/test_linkify.py::test_email_link[email tests/test_linkify.py::test_email_link[<br>jinkyun@example.com-True-<br><a tests/test_linkify.py::test_email_link[mailto tests/test_linkify.py::test_email_link["\\\n"@opa.ru-True-"\\\n"@opa.ru] tests/test_linkify.py::test_email_link_escaping["james"@example.com-<a tests/test_linkify.py::test_email_link_escaping["j'ames"@example.com-<a tests/test_linkify.py::test_email_link_escaping["ja>mes"@example.com-<a tests/test_linkify.py::test_prevent_links[callback0-a tests/test_linkify.py::test_prevent_links[callback1-a tests/test_linkify.py::test_prevent_links[callback2-a tests/test_linkify.py::test_prevent_links[callback3-a tests/test_linkify.py::test_prevent_links[callback4-a tests/test_linkify.py::test_prevent_links[callback5-a tests/test_linkify.py::test_set_attrs tests/test_linkify.py::test_only_proto_links tests/test_linkify.py::test_stop_email tests/test_linkify.py::test_tlds[example.com-<a tests/test_linkify.py::test_tlds[example.co-<a tests/test_linkify.py::test_tlds[example.co.uk-<a tests/test_linkify.py::test_tlds[example.edu-<a tests/test_linkify.py::test_tlds[example.xxx-<a tests/test_linkify.py::test_tlds[bit.ly/fun-<a tests/test_linkify.py::test_tlds[example.yyy-example.yyy] tests/test_linkify.py::test_tlds[brie-brie] tests/test_linkify.py::test_escaping tests/test_linkify.py::test_nofollow_off tests/test_linkify.py::test_link_in_html tests/test_linkify.py::test_links_https tests/test_linkify.py::test_add_rel_nofollow tests/test_linkify.py::test_url_with_path tests/test_linkify.py::test_link_ftp tests/test_linkify.py::test_link_query tests/test_linkify.py::test_link_fragment tests/test_linkify.py::test_link_entities tests/test_linkify.py::test_escaped_html tests/test_linkify.py::test_link_http_complete tests/test_linkify.py::test_non_url tests/test_linkify.py::test_javascript_url tests/test_linkify.py::test_unsafe_url tests/test_linkify.py::test_skip_tags tests/test_linkify.py::test_libgl tests/test_linkify.py::test_end_of_sentence[example.com-.] tests/test_linkify.py::test_end_of_sentence[example.com-...] tests/test_linkify.py::test_end_of_sentence[ex.com/foo-.] tests/test_linkify.py::test_end_of_sentence[ex.com/foo-....] tests/test_linkify.py::test_end_of_clause tests/test_linkify.py::test_sarcasm tests/test_linkify.py::test_wrapping_parentheses[(example.com)-expected_data0] tests/test_linkify.py::test_wrapping_parentheses[(example.com/)-expected_data1] tests/test_linkify.py::test_wrapping_parentheses[(example.com/foo)-expected_data2] tests/test_linkify.py::test_wrapping_parentheses[(((example.com/))))-expected_data3] tests/test_linkify.py::test_wrapping_parentheses[example.com/))-expected_data4] tests/test_linkify.py::test_wrapping_parentheses[(foo tests/test_linkify.py::test_wrapping_parentheses[http://en.wikipedia.org/wiki/Test_(assessment)-expected_data7] tests/test_linkify.py::test_wrapping_parentheses[(http://en.wikipedia.org/wiki/Test_(assessment))-expected_data8] tests/test_linkify.py::test_wrapping_parentheses[((http://en.wikipedia.org/wiki/Test_(assessment))-expected_data9] tests/test_linkify.py::test_wrapping_parentheses[(http://en.wikipedia.org/wiki/Test_(assessment)))-expected_data10] tests/test_linkify.py::test_wrapping_parentheses[(http://en.wikipedia.org/wiki/)Test_(assessment-expected_data11] tests/test_linkify.py::test_wrapping_parentheses[hello tests/test_linkify.py::test_parentheses_with_removing tests/test_linkify.py::test_ports[http://foo.com:8000-expected_data0] tests/test_linkify.py::test_ports[http://foo.com:8000/-expected_data1] tests/test_linkify.py::test_ports[http://bar.com:xkcd-expected_data2] tests/test_linkify.py::test_ports[http://foo.com:81/bar-expected_data3] tests/test_linkify.py::test_ports[http://foo.com:-expected_data4] tests/test_linkify.py::test_ports[http://foo.com:\u0663\u0669/-expected_data5] tests/test_linkify.py::test_ports[http://foo.com:\U0001d7e0\U0001d7d8/-expected_data6] tests/test_linkify.py::test_ignore_bad_protocols tests/test_linkify.py::test_link_emails_and_urls tests/test_linkify.py::test_links_case_insensitive tests/test_linkify.py::test_elements_inside_links tests/test_linkify.py::test_drop_link_tags tests/test_linkify.py::test_naughty_unescaping[&lt;br&gt;-&lt;br&gt;] tests/test_linkify.py::test_naughty_unescaping[&lt;br&gt; tests/test_linkify.py::test_hang tests/test_linkify.py::test_hyphen_in_mail tests/test_linkify.py::test_url_re_arg tests/test_linkify.py::test_email_re_arg tests/test_linkify.py::test_recognized_tags_arg tests/test_linkify.py::test_linkify_idempotent tests/test_linkify.py::TestLinkify::test_no_href_links tests/test_linkify.py::TestLinkify::test_rel_already_there tests/test_linkify.py::TestLinkify::test_only_text_is_linkified tests/test_linkify.py::test_linkify_filter[abc-abc] tests/test_linkify.py::test_linkify_filter[example.com-<a tests/test_linkify.py::test_linkify_filter[http://example.com?b=1&c=2-<a tests/test_linkify.py::test_linkify_filter[http://example.com?b=1&amp;c=2-<a tests/test_linkify.py::test_linkify_filter[link: