Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Shopify/rejectu

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rejectu

A simple Ruby extension that verifies that a UTF-8 string does not contain any characters from supplementary planes (code points >= U+10000).

Features

  • C extension that uses SSE2 for webscale

Installation

gem install rejectu

or if you're using bundler add the following to your Gemfile

gem "rejectu"

Usage

require 'rejectu/rejectu'

Rejectu.valid?("happy! \xf2\xa4\xb7\xa4") # false
Rejectu.valid?("really happy!") # true
Rejectu.valid?("this should be good too \xe2\x84\xa2") # true

Rejectu.scrub("happy! \xf2\xa4\xb7\xa4") # => "happy! ?"

# using a custom replacement character
Rejectu.scrub("happy! \xf2\xa4\xb7\xa4", ".") # => "happy! ."

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 52.0%
  • Ruby 48.0%