Project

rejectu

0.01
No commit activity in last 3 years
No release in over 3 years
This gem detects if a UTF-8 encoded string contains characters from the UTF-8 supplementary plane (code points >= U+10000).
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

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! ."