We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b89e8c0 commit a2761f5Copy full SHA for a2761f5
pandas/tests/io/parser/test_read_fwf.py
@@ -634,3 +634,24 @@ def test_binary_mode():
634
df = pd.read_fwf(file)
635
file.seek(0)
636
tm.assert_frame_equal(df, df_reference)
637
+
638
639
+@pytest.mark.parametrize("memory_map", [True, False])
640
+def test_encoding_mmap(memory_map):
641
+ """
642
+ encoding should be working, even when using a memory-mapped file.
643
644
+ GH 23254.
645
646
+ encoding = "iso8859_1"
647
+ data = BytesIO(" 1 A Ä 2\n".encode(encoding))
648
+ df = pd.read_fwf(
649
+ data,
650
+ header=None,
651
+ widths=[2, 2, 2, 2],
652
+ encoding=encoding,
653
+ memory_map=memory_map,
654
+ )
655
+ data.seek(0)
656
+ df_reference = pd.DataFrame([[1, "A", "Ä", 2]])
657
+ tm.assert_frame_equal(df, df_reference)
0 commit comments