Skip to content

Commit 805dba8

Browse files
committed
Introduction of the split and support of the \032 separator.
This patch fixes #139. Indeed, before this patch, we did not support the \032 separator. To quote the RFC 6763: > Note that nslookup escapes spaces as "\032" for display purposes, but a graphical DNS-SD browser should not. Therefore, as of now, we will comply by replacing the given line with a space before parsing it to our normal decoding workflow. Contributors: * @ZeroDot1
1 parent 8fa6885 commit 805dba8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

PyFunceble/converter/input_line2subject.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class InputLine2Subject(ConverterBase):
6464

6565
COMMENT: str = "#"
6666
SPACE: str = " "
67+
NSLOOKUP_SPACE: str = "\\032"
6768
TAB: str = "\t"
6869

6970
@ConverterBase.data_to_convert.setter
@@ -94,6 +95,12 @@ def get_converted(self) -> List[str]:
9495
if self.COMMENT in subject:
9596
subject = subject[: subject.find(self.COMMENT)].strip()
9697

98+
if self.NSLOOKUP_SPACE in subject:
99+
# Comply with RFC 6367:
100+
# Note that nslookup escapes spaces as "\032" for display
101+
# purposes, but a graphical DNS-SD browser should not.
102+
subject = subject.replace(self.NSLOOKUP_SPACE, self.SPACE)
103+
97104
if self.SPACE in subject or self.TAB in subject:
98105
splitted = subject.split()
99106

0 commit comments

Comments
 (0)