### Godot version

4.1.dev (1becfea37c)

### System information

MacOS 13.3 M1 Pro

### Issue description

When renaming with Batch Rename using invalid character `NodePath` will be updated with the invalid new name.

### Steps to reproduce

1.  open MRP
2. batch rename all nodes except the root from `e` to `%`
3. look at the `NodePath` on the root

### Minimal reproduction project

[test1.zip](https://github.com/godotengine/godot/files/11377324/test1.zip)

} else if (case_id == 2) {
		
		result = result.to_upper();
	}
	return result;
}
void RenameDialog::_iterate_scene(const Node *node, const Array &selection, int *counter) {
	if (!node) {
		return;
	}
	if (selection.has(node)) {
		String new_name = _apply_rename(node, *counter);
		if (node->get_name() != new_name) {
			Pair<NodePath, String> rename_item;
			rename_item.first = node->get_path();
			rename_item.second = new_name;
			to_rename.push_back(rename_item);
		}
		*counter += spn_count_step->get_value();
	}
	int *cur_counter = counter;
	int level_counter = spn_count_start->get_value();
	if (chk_per_level_counter->is_pressed()) {
		cur_counter = &level_counter;
	}
	for (int i = 0; i < node->get_child_count(); ++i) {
		_iterate_scene(node->get_child(i), selection, cur_counter);
	}
}
void RenameDialog::rename() {