Decode URL paramters and Umlauts

Good afternoon

I’m trying to handle the URL scheme apple event which launches my barcoder app fine…

Only problem is that it won’t display then the text correctly with Umlauts…

For example this link parameter:


is turned into during link opening:


Which is fine…but Xojo renders it then in a TextField as:


Setting the TextFields manually like:

ctrl.Text = “Mäny Ümläüts”

Works fine though…so is there some UTF8 conversion function missing here?
Text.DefineEncoding(Encodings.UTF8) and DecodeURLComponent don’t work…

thanks in advance

If the text isn’t utf8 then test with IsoLatin1.

1 Like

It is actually the ASCII representation of UTF8:

%C3BC is the encoding in ASCII for ü

Seems the only way to search/replace for each individual UTF8 representation and replace it as I don’t see any encoding which matches this…

In Swift this is done transparently…

In Xojo encodings are handled transparently, too. Please show us your complete code.

This code works for me

  dim s as string = "B%C3%BCechschew%C3%A4g"
  dim t as string = DecodeURLComponent(s)
  t = DefineEncoding(t, encodings.utf8)
  textfield1.text = t

I get umlauts in the text field.

Using this code:

dim p as NSAppleEventDescriptorMBS = theEvent.paramDescriptorForKeyword("----")

Dim params() as String
Dim s() as String
Dim line as String

line = DecodeURLComponent(p.stringValue)
params = line.Split("?")

If params.count = 2 Then
  Dim param() as String = params(1).Split("&")
  For Each par as String in param
    s = par.Split("=")
End If

If Parameters.count > 0 Then
  For i as Integer = 0 to Parameters.LastIndex
    Dim ctrl as DesktopTextField
    ctrl = Window1.GetControl(Parameters(i))
    If ctrl <> nil Then
      ctrl.Text = Values(i)
    End If
End If

I get with using PHP urlencode for GET parameters:


Or without using urlencode in PHP:

B��echschew��g 5


ctrl.Text = DefineEncoding(Values(i), encodings.utf8)
1 Like

Ah that works…but only without doing urlencode in PHP and then without DecodeURLComponent :slight_smile:

What are you trying to do? I never had to use DecodeURLComponent when dealing with NSAppleEventDescriptorMBS.