gogb2312

package module
v0.0.0-...-f69125f Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: Apache-2.0 Imports: 7 Imported by: 5

README

gogb2312

convert gb2312(cp936) to utf-8

Usage:

转换gb2312编码为utf8编码

func ConvertGB2312(input []byte) (output []byte, err error, ic int, oc int)

参数: input 待转换的gb2312编码的byte数组

返回: output 转换后的utf8编码的byte数组 err 错误码,如果成功为nil ic 成功转换的input的长度,如果input转换部分成功时,返回成功部分的长度 oc output的长度

output, err, ic, oc := ConvertGB2312(input)

func ConvertGB2312String(input string) (soutput string, err error, ic int, oc int)

与ConvertGB2312类似,不过参数和返回值由[]byte改为string

Documentation

Index

Constants

View Source
const (
	UTF8_B1 = 0x80
	UTF8_B2 = 0x80
	UTF8_B3 = 0xe0
)
View Source
const (
	UTF8_B7FF     = 0xc0
	UTF8_1FFFFF   = 0xf0
	UTF8_3FFFFFF  = 0xf8
	UTF8_7FFFFFFF = 0xfc
)

Variables

This section is empty.

Functions

func ConvertGB2312

func ConvertGB2312(input []byte) (output []byte, err error, ic int, oc int)

param: input: input bytes array return: output: output bytes array

err: error if there are errors when convert
ic: input has been converted
oc: output has been converted

func ConvertGB2312String

func ConvertGB2312String(input string) (soutput string, err error, ic int, oc int)

func ConvertHybirdString

func ConvertHybirdString(input string) (soutput string, err error, ic int, oc int)

Types

This section is empty.

Jump to

Keyboard shortcuts

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