🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis
Socket
Book a DemoInstallSign in
Socket

utfu

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

utfu

Replaces busted characters carried over from legacy text encodings with the proper UTF-8 character.

Source
npmnpm
Version
0.2.2
Version published
Weekly downloads
21
600%
Maintainers
1
Weekly downloads
 
Created
Source

Welcome to utfu 👋

Version License: MIT Twitter: selfagency\_llc

Replaces busted characters carried over from legacy text encodings with the proper UTF-8 character.

Install

yarn add utfu || npm install utfu

Usage

Say you've got a string that looks like this:

There's no way I'm paying €30 for that!

Pass it to either method, hex, txt, or htx and you'll hopefully get back:

There's no way I'm paying €30 for that!

hex substitutes unicode hex values (ie., \u20ac), which is useful in some contexts. txt substitutes the actual character (ie., ). And htx substitutes the HTML escape sequence (ie., €). See chart here for mappings.

import { hex, txt, htx } from 'utfu'

const dirtyText = 'On a certain level, it�s like shouting �fire� in a crowded theater.'

const cleanText = hex(dirtyText) || txt(dirtyText)

// --> 'On a certain level, it’s like shouting “fire” in a crowded theater.'

const cleanHTML = htx(dirtyText)
// --> 'On a certain level, it’’s like shouting “fire” in a crowded theater.'

Run tests

yarn run test

Author

👤 Daniel Sieradski hello@self.agency

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

This README was generated with ❤️ by readme-md-generator

Keywords

utf

FAQs

Package last updated on 30 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts