LDAP / AD integration and space in uid?

We are using LDAP / AD integration and from expert settings we define that internal username is samaccountname but now we have this problem that Nextcloud replaces spaces in that variable with underscore. Now we also have external storages that Nextcloud mounts for the users and uses that samaccountname in $user that is configured for the sub folder on the cifs mount. Users have the folders there with spaces and Nexcloud tries to use them with the underscore in the username and naturally it does not work. Is there any particular reason for Nextcloud to change space to underscore when creating the internal username (which is in the database by the name of owncloud_name in oc_ldap_user_mapping table). Can i change that behaviour from sorce code in some file to add the space to allowed characters? Or is there a reasonable explain why spaces are forbidden in the internal user name?

Hi @JaVa did you find any solution?