DevToys-app / DevToys

A Swiss Army knife for developers.
https://devtoys.app/
MIT License
26.91k stars 1.45k forks source link

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

Open doggy8088 opened 1 year ago

doggy8088 commented 1 year ago

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
pulsarleaf commented 1 year ago

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.

ebejko commented 1 year ago

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

doggy8088 commented 1 year ago

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.