Git Product home page Git Product logo

ecdc's Introduction

Build Status

ECDC

The Encode/Decode (ecdc) extension allows you to quickly convert one or more selections of text to and from various formats. Supported conversions include:

  • String to Base64
  • Base 64 to String
  • String to JSON Byte Array
  • String to JSON String
  • JSON String to String
  • Base64 to JSON Byte Array
  • String to MD5/SHA1/SHA256/SHA512 (as Base64 or Hex)
  • String to HTML Entities
  • HTML Entities to String
  • String to XML Entities
  • XML Entities to String
  • String to Unicode
  • Unicode to String

How to Use

The extension provides a single command to the command palette. To active the command simply launch the command palette (Shift-CMD-P on OSX or Shift-Ctrl-P on Windows and Linux), then just type Encode/Decode: Convert Selection, then a menu of possible conversions will be displayed. Alternatively you can use the keyboard bindings CMD-ALT-C and CTRL-ALT-C for Mac & PC respectively.

Contributors

Thanks to everyone who has submitted issues and pull requests, shout outs to:

  • 7sDream
  • fcharron
  • jtanx

ecdc's People

Contributors

7sdream avatar aersh avatar azure-pipelines[bot] avatar jtanx avatar lukas238 avatar mitchdenny avatar renovate-bot avatar wmaurer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ecdc's Issues

Feature request: encode / decode HTML5 entities

It would be great to be also able to encode/decode HTML entities. I thought about writing my own extension for this (I already have published 3), but I feel it might complement yours quite well.

There's a node package that could be used for this:
https://www.npmjs.com/package/ent

What do you think? If you want I could also make a PR with this feature ...

How to keep new lines

I am writing docs and I have to encode HTML for rendering. Now probem is when I convert it to HTML entities all lines are convert in single line.

Original:

<feather-icon class="mr-1" icon="InfoIcon" />
<feather-icon class="mr-1" icon="HomeIcon" />
<feather-icon class="mr-1" icon="UserIcon" />
<feather-icon icon="TwitterIcon" />

Converted:

&lt;feather-icon class=&quot;mr-1&quot; icon=&quot;InfoIcon&quot; /&gt;&#10;&lt;feather-icon class=&quot;mr-1&quot; icon=&quot;HomeIcon&quot; /&gt;&#10;&lt;feather-icon class=&quot;mr-1&quot; icon=&quot;UserIcon&quot; /&gt;&#10;&lt;feather-icon icon=&quot;TwitterIcon&quot; /&gt;

How can I preserve the new lines(\n).

Feature Request: `yaml` to `json` and `json` to `yaml`

Please add for conversion between yml/yaml text and json. Since yaml is a superset of json, there should be a straight-forward-least-common-denominator way to make sure there can be bidirectional conversion. Even if yaml back to json may be lossy (i.e. anchors in yaml).

base to string

Sir, ask for help.
I need to put a string to decode( the string is base64 format),and display it by hex format。But your tool conversion differs from the notepad++ conversion。notepad++ is right for me.
egg.
string is 9PUAQCkAAAEB/gEAAGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHP9Ps=
your tools convert result is (base64 to string)
3F3F004029000001013F010000650000000000000000000000000000000000000000000000000000000000000000013F3F3F
notepad++ is (base64 decode)
F4F500402900000101FE01000065000000000000000000000000000000000000000000000000000000000000000001CFF4FB

Can you say why? thank you

Add a configration to select decimal encode for HTML entities

I use this plugin to escape html entities in emails, like the smart quotes and the amperstand.

Now, Outlook.com and Outlook app fail to render the Names HTML Entity ( like &rsquo;) but will render fine the Decimal HTML Entity ( like &#8217;).

More info here: http://www.fileformat.info/info/unicode/char/2019/index.htm

Can be added a configuration setting for the extencion to define the encoding type (HTML Entity (decimal), HTML Entity (hex), HTML Entity (named))?

Thanks!!

Feature: XML/HTML encode without quotes

When writing HTML code that should display HTML code, the only characters that need encoding are < and &. For reasons of symmetry (and maybe "readability"), also > should be encoded. Quotes ' and " do not need to be encoded in plain HTML text content.

I suggest adding a conversion that covers the three mentioned characters but no quotes. There's no difference between HTML and XML for this matter, so the conversion name could be both. Maybe naming it XML would be more appropriate.

Shortcut for specific function

Firstly, Thank you for the helpful package.
I use the string to html entities function the most, and I want to bind the ctrl+alt+c to do this string to HTML function only, to avoid the additional step to select the string to html.
How can I do that?

Encoding only special char

Is it possible to implement an option to encode just special characters (Brazilian Portuguese has a lot of special characters)? That would be a great feature!

consider using "encode/decode" for command

Great work there!
I have a suggestion. The extension is called encode/decode which is a suitable name for what it does. However, the execution command "convert selection" is hard to remember.
how about having an execution command that starts with the name of the extension like "encode/decode: convert selection"? This is a very typical pattern that i've seen with vscode extensions.
That way you can promote all the sub options, such that they live at the same level.

Feature Request: Use Encode/Decode instead of "String to" and "to String"

I personally find hard to quick find required command while visually scanning all similarly looking "String to xxx" options.
Can we switch to encode/decode notation instead? (probably can be even configurable to not annoy users used to current schema)

  • Encode to Base64
  • Decode from Base64
  • Encode to JSON Byte Array
  • Encode Base64 to JSON Byte Array
  • Encode to MD5 Hash (as Base64 or Hex)
  • Encode to HTML Entities
  • Decode HTML Entities
  • Encode to XML Entities
  • Decode XML Entities
  • Encode to Unicode
  • Decode Unicode
  • Encode Url
  • Decode Url
  • Encode Url Component
  • Decode Url Component
  • Encode Url Component (All Characters)

The `Encode/Decode: Convert Selection` command does not show up

VSCode version: 1.67.2
ecde version: 1.7.0

Don't know starting from which version, only see the command extension.subtleConvertSelection's Convert Selection, but no extension.convertSelection's Encode/Decode: Convert Selection on the VSCode's Command Palette, as shown in the sreenshot below.

image

FR: URL encode/decode

Please add url encode/decode functionality.

Update:
I see there is already functionality using encodeURIComponent (not documented, BTW).
Maybe you can split this into 2 cases:

  • String to Encoded Url: will use encodeURI()
  • String to Encoded Url Component: will use encodeURIComponent()

Does not work a second time

  1. Select some base64 code.
  2. invoke "encode/decode" command
  3. in second menu, convert to string
  4. edit the string (although this is not necessary, but is the usual workflow)
  5. invoke "encode/decode" command

No second menu appears. Cannot convert.

If I do "developer > reload window" then I can run the command again.

This has been a bug for a long time, so not dependent on the current version of VSCode, although I am on Version: 1.39.0-insider.

String -> HTML encoding shouldn't encode newlines

Hi, thanks for the useful plugin.

I find that on a Mac, when I encode a chunk of HTML into HTML entities all newlines are replaced by &#10;. In years of coding I have never found situation where I may need that (if anything, multiple &nbsps may be more useful, although I woudln't want that by default either). Do you think there is a chance to make that configurable on the settings?

Thanks.

Feature Request: LZ-String compatibility

I've been working a lot with pieroxy's LZ-String Base64 compressed stuff and would appreciate ECDC eventually getting a release with support for decompressing it so I don't have to rely on external programs. There's no other extension on the marketplace for any variety of encoding/compression of it at the time of this writing.

Feature/option: Encode HTML without character entities

I see no reason why characters like ö should be converted to &ouml;. I'm successfully using Unicode for my websites for 20 years now. This has resolved all such issues and none of the non-ASCII characters need to be encoded anymore. Encoding invisible characters like &nbsp; might be useful, but most entities are obsolete.

Feature Request: Full right-click context menu integration

I love ECDC, but I would really love it if you could possibly add full support for the right click context menu as it's a little tedious having to go to the command palette. I know there is a "Convert Selection" option already there, however it would be great to have that implemented as a fully operational sub-menu. As a last resort I'm currently trying to code my own extension to push the functionality of ECDC into a menu.

Thanks much for the great extension.

Jay

XML encoding shouldn't encode em dashes, etc.

This seemed like a great tool. But then when I want to encode a string for XML, it encodes things like the em-dash “—” with a character reference. That doesn't break anything but it's pointless. It's 2020, and all our fonts and editors can handle em dash glyphs just fine.

This encoding should only encode things absolutely necessary for XML, such as &, <, and >. In fact I'd like a way to turn off encoding " and '. (In fact &apos; wasn't even officially supported in HTML 4.)

I know this is the XML encoding, not the HTML encoding, but I'd still like to configure which things get converted, and these arbitrary extra characters shouldn't be encoded just because they aren't ASCII. (It might have been appropriate in the 1990s.)

JSON Byte Array to string

Feature Request:
What I need at the moment is JSON Byte array to string.

[104,101,108,108,111,32,119,111,114,108,100] --> hello world

Spaces not being converted into html entities

If the select text contains spaces, the spaces are not converted into html entities.
Even if I select a single space, it won't be translated into a html entity.
It's possible that this is the intended behavior but sometimes you just want the spaces to be converted.

Maybe it could be possible to let uses decided if they want the spaces converted or not.

Deprecation warning when debugging

(node:3996) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.