DevToys
DevToys copied to clipboard
URL Encoder should treat newline to %0D%0A
Description

Steps To Reproduce
-
Go to 'Encoders / Decoders > URL'
-
Choose 'Encode'
-
Input:
123 123 -
Output will be
123%0D123which is wrong. It should be123%0D%0A123or123%0A123
Expected behavior
It should be 123%0D%0A123 or 123%0A123.
DevToys Version
Version 1.0.10.0 | X64 | RELEASE | b949a18 | b949a18
Relevant Assets/Logs
# - [02/20/2023 17:07:53]
Feature name: Failed to copy from custom text box
Custom message:
Exception message: OpenClipboard Failed (Exception from HRESULT: 0x800401D0)
Exception stack trace:
at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21
at __Interop.ComCallHelpers.Call(__ComObject, RuntimeTypeHandle, Int32) + 0xb8
at __Interop.ForwardComStubs.Stub_17[TThis](__ComObject, Int32) + 0x24
at Windows.ApplicationModel.DataTransfer.Clipboard.Flush() + 0x2c
at DevToys.UI.Controls.CustomTextBox.CopyTextBoxSelectionToClipboard() + 0xc6
From my testing, it seems the inherent C# functions used for the URL Encoder have no option for it to return anything other than a %0D. It would require a custom function to either do the whole encoding or to scan for %0D and add %0A after or replace it.
Could be related to this issue https://github.com/microsoft/microsoft-ui-xaml/issues/1826
I think @ebejko is right. It's related to textbox control. Any text put it on that control. All the newline can only be interpret as \r only. It's so weird.
No matter what this issue should be addressed and it's fundamental. This should have some way to solve it.