Fix .NET MAUI entry special characters not displayed

Arthur Pierrot 0 Reputation points
2023-09-04T14:50:54.1366667+00:00

Hello,

I just started using .NET MAUI and I followed this tutorial for beginners: https://www.youtube.com/playlist?list=PLdo4fOcmZ0oUBAdL2NwBpDs32zwGqb9DY.

In this tutorial, the main view contains an entry and a button next to it to add the text in the entry to a collection view below. Then, we can tap on any collection view items to access a detailed page with the title being the item's name.

My problem occurs when I type for example "C++" in the entry. I then add it to the collection with the button which shows correctly a collection view item with the text "C++". But then when I tap on it to go to the detailed view, I see the page title "C ", with the "++" replaced by 2 white spaces.

I have the same problem if I type any character that is not alphanumeric. How can I fix this and why is this occurring in the first place?

Thank you very much

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,231 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Arthur Pierrot 0 Reputation points
    2023-09-05T09:00:56.05+00:00

    That solved it for me! For anyone wondering, here is my function that is called when I tap on one of the collection view items:

    [RelayCommand]
    async Task Tap(string s)
    {
        s = Uri.EscapeDataString(s); // I convert the string before passing it in parameter
        await Shell.Current.GoToAsync($"{nameof(DetailPage)}?Text={s}");
    }