futf

package module
v0.0.0-...-2bbac4a Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: MIT Imports: 6 Imported by: 1

README

force-utf8

Windows1251
Scenario:
  • original Windows-1251 text has been mis-interpreted as Windows-1252
  • then those mis-interpreted characters are themselves turned into their UTF-8 equivalents
Example:

Мировая фанстастика от А до Я -> Ìèðîâàÿ ôàíñòàñòèêà îò À äî ß

Usage

import github.com/fullpipe/futf

futf.ToUTF8("Ìèðîâàÿ ôàíñòàñòèêà îò À äî ß") // Мировая фанстастика от А до Я

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllInOne = allInOneGuesser{
	// contains filtered or unexported fields
}

Functions

func Dec

func Dec(s []byte, enc encoding.Encoding) []byte

func Enc

func Enc(s string, enc encoding.Encoding) []byte

func ToUTF8

func ToUTF8(str string) string

Types

type CharmapDecoder

type CharmapDecoder struct {
	encoding.Encoding
}

func (*CharmapDecoder) Decode

func (d *CharmapDecoder) Decode(str []byte) []byte

type Decoder

type Decoder interface {
	Decode(str []byte) []byte
}

type Guesser

type Guesser interface {
	Guese(str []byte) (Decoder, int)
}

type MissCodedDecoder

type MissCodedDecoder struct {
	// contains filtered or unexported fields
}

Solves cases when original text in Windows1251 was missinterpreted as Windows1252 and than was encoded to unicode

func (*MissCodedDecoder) Decode

func (d *MissCodedDecoder) Decode(str []byte) []byte

type UtfBOM

type UtfBOM struct{}

func (*UtfBOM) Guese

func (g *UtfBOM) Guese(str []byte) (Decoder, int)

type Windows1251

type Windows1251 struct{}

func (*Windows1251) Guese

func (g *Windows1251) Guese(str []byte) (Decoder, int)

Jump to

Keyboard shortcuts

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