Forum > General

SetCodePage behaviour

(1/1)

Zoran:
The official documentation says nothing about how SetCodePage behaves when the string parameter contains characters which cannot be converted to resulting code page.

So, the question is, when calling this function with Convert parameter set to true, and the string contains some character that cannot be represented in new code page, will it raise some exception, or simply ignore it, or...?

Thaddy:
What makes you think so?
A small example will help.

Jonas Maebe:
The character will be replaced with '?'

Zoran:

--- Quote from: Jonas Maebe on September 24, 2022, 11:16:45 am ---The character will be replaced with '?'

--- End quote ---

Thank you, Jonas!


--- Quote from: Thaddy on September 24, 2022, 11:14:33 am ---What makes you think so?
A small example will help.

--- End quote ---

Thaddy, you misunderstood, I didn't think "so", as I didn't assume anything.
I just wanted to be sure, how to write the code to handle this situation -- should I enclose it in try-except or do it some other way.

So now I know.
And, by the way, I will handle it with doing nothing, as the default behaviour with "?" will be quite satisfying for what I need. :)

Navigation

[0] Message Index

Go to full version