utfbomremover

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2022 License: MIT Imports: 1 Imported by: 1

README

utfbomremover

GitHub Go Report Card GitHub Workflow Status

Overview

transform.Transformer to remove Unicode BOM (Byte Order Mark).

UnicodeのBOM(Byte Order Mark)を削除するtransform.Transformer

Usage

const base = []byte("一二三四五六七八九十拾壱")
msg := append([]byte{0xEF, 0xBB, 0xBF}, base...)

// true
fmt.Println(utfbomremover.ISUTF8BOM(msg))

var buf bytes.Buffer
w := transform.NewWriter(&buf, utfbomremover.NewTransformer())
if _, err := w.Write(msg); err != nil {
    panic(err)
}
if err := w.Close(); err != nil {
    panic(err)
}

// false
fmt.Println(utfbomremover.ISUTF8BOM(buf.Bytes()))

Documentation

Index

Constants

View Source
const (
	BOMSize4Byte = 4
	BOMSize3Byte = 3
	BOMSize2Byte = 2
)

Variables

This section is empty.

Functions

func IsUTF16BigEndianBOM added in v0.1.1

func IsUTF16BigEndianBOM(buf []byte) bool

func IsUTF16LittleEndianBOM added in v0.1.1

func IsUTF16LittleEndianBOM(buf []byte) bool

func IsUTF32BigEndianBOM added in v0.1.1

func IsUTF32BigEndianBOM(buf []byte) bool

func IsUTF32LittleEndianBOM added in v0.1.1

func IsUTF32LittleEndianBOM(buf []byte) bool

func IsUTF8BOM added in v0.1.1

func IsUTF8BOM(buf []byte) bool

func NewTransformer

func NewTransformer() transform.Transformer

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL