@taazz: Since this is based on your code: Would you allow me to add this to bug tracker?
Sure go ahead. I'll be honored to have any piece of code in fpc or lazarus. BUT and its a big but, I have already mentioned it in this thread, why don't you use the functions provided in the unit typinfo named SetToString and StringToSet which does exactly what the name implies? I see nothing here that is not allready covered on those functions.