When using a text field in the inspector special characters seem to be used.
For example typing \n will produce a new line in the field, and \r will return the string to the beginning which shows overlapping text in the field.
for example in the inspector for a string field, you can see this behaviour.
[SerializedField]
private string foo;
I’m currently using Unity 2022.2.12f
Is this intended behaviour or is this a bug?
If it’s intended how can I prevent this.

Can you elaborate where you are talking about exactly? Because some things will and should support it, others won't.
– vertxxyzThis is just in the inspector, with a string field. [SerializedField] private string foo;
– CookieWall