Skip to content

Commit

Permalink
hacky fix to non-ascii design names
Browse files Browse the repository at this point in the history
  • Loading branch information
psychogenic committed Dec 4, 2024
1 parent 3b484be commit f3b13e1
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/ttboard/project_mux.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,20 @@ def deserialize_int(cls, bytestream, num_bytes):
def serialize_string(cls, s:str):
slen = len(s)
bts = slen.to_bytes(cls.BytesForStringLen, cls.ByteOrder)
bts += bytearray(s, cls.StringEncoding)

try:
enc = bytearray(s, cls.StringEncoding)
except:
news = ''
for i in range(len(s)):
c = s[i]
if ord(c) < ord('A') or ord(c) > ord('z'):
news += '_'
else:
news += c
enc = bytearray(news, cls.StringEncoding)

bts += enc
return bts

@classmethod
Expand Down Expand Up @@ -644,4 +657,4 @@ def __str__(self):
def __repr__(self):
des_idx = self.projects
return f'<ProjectMux for {self.run} with {len(des_idx)} projects>'


0 comments on commit f3b13e1

Please sign in to comment.