Skip to content

Commit 2ba2ee0

Browse files
committed
refactor: enhance character conversion to allow underscores in cleaned names
1 parent e7a3562 commit 2ba2ee0

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/rda_python_common/PgLOG.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,13 +1583,11 @@ def check_process_host(hosts, chost = None, mflag = None, pinfo = None, logact =
15831583
# convert special foreign characters into ascii characters
15841584
#
15851585
def convert_chars(name, default = 'X'):
1586-
15871586
if not name: return default
15881587
if re.match(r'^[a-zA-Z0-9]+$', name): return name # conversion not needed
1589-
15901588
decoded_name = unidecode(name).strip()
1591-
cleaned_name = re.sub(r'[^a-zA-Z0-9]', '', decoded_name)
1592-
1589+
# remove any non-alphanumeric and non-underscore characters
1590+
cleaned_name = re.sub(r'[^a-zA-Z0-9_]', '', decoded_name)
15931591
if cleaned_name:
15941592
return cleaned_name
15951593
else:

0 commit comments

Comments
 (0)