DevToys icon indicating copy to clipboard operation
DevToys copied to clipboard

URL Encoder should treat newline to %0D%0A

Open doggy8088 opened this issue 2 years ago • 3 comments

Description

image

Steps To Reproduce

  1. Go to 'Encoders / Decoders > URL'

  2. Choose 'Encode'

  3. Input:

    123
    123
    
  4. Output will be 123%0D123 which is wrong. It should be 123%0D%0A123 or 123%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

doggy8088 avatar Feb 20 '23 09:02 doggy8088

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.

pulsarleaf avatar Mar 04 '23 23:03 pulsarleaf

Could be related to this issue https://github.com/microsoft/microsoft-ui-xaml/issues/1826

ebejko avatar Mar 08 '23 12:03 ebejko

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.

doggy8088 avatar Mar 26 '23 23:03 doggy8088