Closed einhugur closed 8 months ago
@einhugur PR looks good, could you please add a test case with a couple different code pages and some text as an example in the console test app? Maybe Chinese, Japanese, Korean, Russian and the code page you need? This would let me validate it on my printer and get it merged / new version released!
I added test for Icelandic (Codepage 861). I have no knowledge to add for other languages, I think others that are natives in given languages will have to add that.
There is one thing I am not 100% sure of......that is if its 100% given that all systems have all code page converters or if its situational given your regional install of your OS. Like for example I am not sure if you have Icelandic code page converter since you do not have Icelandic system. (Remains to be seen)
In general though then those that will want to use those functions will obviously have their OS correct for their native code page which they want to use.
@lukevp and @einhugur this PR was not linked to #256 so I totally missed it before opening #260
My main concern about this PR is that every single time someone wishes to call Print
or PrintLine
methods they will have to pass on an Encoding. Actually, the way this PR describes you just pass an int
for the codepage, and assumes there's a related Encoding to be instantiated (which not always is the case and can generate an Exception).
I think we should intake an instance of Encoding
and furthermore, instead of intaking it every time Print or PrintLine are called, I think a property in the emitter where the user can set it once (and modify it later as needed) is less verbose. Please check such implementation in #260 and let me know if that works for both of you.
FYI, I updated README.md with an example of Chinese characters based on #256 and #86
@einhugur I'm going to close this PR, but a very similar solution was done and merged with #260
Please take a look at the current README.md and let me know if you have any questions, but pretty much instead of passing an int to be used in the Encoding, you would need to pass the actual instantiated Encoding to the library.
Added overide to have printed string and printed line converted to given codepage.