Skip to content

Commit

Permalink
non_ascii_to_octal: Return the input string if it only contains print…
Browse files Browse the repository at this point in the history
…able ASCII characters (#3199)
  • Loading branch information
seisman committed Apr 25, 2024
1 parent 8592b54 commit bc673bc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pygmt/helpers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ def non_ascii_to_octal(argstr):
>>> non_ascii_to_octal("ABC ±120° DEF α ♥")
'ABC \\261120\\260 DEF @~\\141@~ @%34%\\252@%%'
""" # noqa: RUF002
# Return the string if it only contains printable ASCII characters from 32 to 126.
if all(32 <= ord(c) <= 126 for c in argstr):
return argstr

# Dictionary mapping non-ASCII characters to octal codes
mapping = {}

Expand Down

0 comments on commit bc673bc

Please sign in to comment.