A text file on a Windows PC is the same as a text file on a Mac
Not exactly.
The content will be the same except that every line ending in the Windows-sourced text file will have a carriage-return in it, which is not compatible with the expected line-feed only ending on macOS (UNIX). Those Windows line endings in the text file will need to be removed in macOS.
This can be done by opening the text file in a programmer's editor (e.g. BBEdit) and resaving the text file with UNIX line endings. Or alternatively in the Terminal application, avoiding any scripting language dependency:
col -b < windows_text.txt > macOS_text.txt