It depends a little on the language, but in general it should not deal with paths on their own, the languages have their own library that knows how to handle it and you work the way without worrying about this detail that is of the operating system. In some cases if the language does not have a standard library it is possible to use one that handles it.
Most people do wrong or use a language that does not provide something ready and correct, which is still a mistake of programming, then one has two options:
- do in a way and establish that the code on the wheel on the platform that the code was thought
- take care at hand to deal with format differences with a huge job and potential to do wrong
Some languages have a constant with the separator, which helps somewhat generalize the code, but doesn’t make it completely simple to do it right. Example in PHP.
It depends on where you use the text presented in the question. There it is only a text, for the system is not a path, only you reading thinks it is. It is true that Apis that access files in the operating system usually understand this text, so can have an API that understands it perfectly and have API that does not understand, including because it has API that does not read only the path, reads other things and the other bar is used to identify something else and is valid in the text, there is ambiguous. Not knowing which API you are using has no way of stating whether it works or not. This feature is not of the language itself, at most of what accompanies it.
In PHP it generally accepts anyway, but I will not guarantee that it always happens. If any way the general recommendation for PHP and other languages is to use a standard, it is usually more appropriate to use the Unix standard. If any API doesn’t work well even in Windows in general we consider it a bad API and you will have to turn around.
If you want to know about the use of characters already have an answer about this in Why in file and folder names, some characters are not yet accepted?.