[Solved] SetCodePage can raise an exception? lazarus / 62-General ---------------------------------------------------------------------- AlexTP · 2022-12-25 11:35 SetCodePage calls fpc_AnsiStr_To_AnsiStr, I cannot find its code in 'fpcsrc' yet. Can it raise an exception (or set another error flag) on conversion error? I need that exception - my app wants to check is some encoding applicable to a file or not. PS. I found the source - fpc_AnsiStr_To_AnsiStr calls widestringmanager methods. But I cannot find their src yet. ---------------------------------------------------------------------- Thaddy · 2022-12-25 11:51 The sources for the default widestring manager are in rtl. ---------------------------------------------------------------------- Bart · 2022-12-25 11:53 AFAICS by testing it will return an empty string if it cannot convert. Bart ---------------------------------------------------------------------- AlexTP · 2022-12-25 12:05 Thanks, empty str is OK for me. ---------------------------------------------------------------------- Bart · 2022-12-25 12:10 Someone with more knowledge (an fpc devel) should confirm this. My conclusion is based upon very limited testing! Bart ---------------------------------------------------------------------- Thaddy · 2022-12-25 12:24 I have the same conclusion as Bart, also after very limited testing, but I am not a devel. Anyway, you can write your own exception handler if empty.