Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid syntax while trying to call Bin2hex #25

Closed
tobychui opened this issue Mar 24, 2020 · 1 comment
Closed

Invalid syntax while trying to call Bin2hex #25

tobychui opened this issue Mar 24, 2020 · 1 comment

Comments

@tobychui
Copy link

The error "strconv.ParseInt: parsing "你好世界": invalid syntax" is returned while trying to run the test code below.

package main

import (
	"fmt"
	"strconv"
	php "github.com/syyongx/php2go"
)

func Bin2hex(str string) (string, error) {
	byteArray := []byte(str)
	var out string;
	for i:=0; i < len(byteArray); i++{
		out += strconv.FormatInt(int64(byteArray[i]), 16)
	}
	return out,nil
}



func main() {
	fmt.Println(Bin2hex("你好世界"))
	fmt.Println(php.Bin2hex("你好世界"))
}

Results as follow.

C:\Users\Toby\Desktop\golang\fsadapt>fsadapt.exe
e4bda0e5a5bde4b896e7958c <nil>
 strconv.ParseInt: parsing "你好世界": invalid syntax

System Information:
OS: Windows 7 64 bit
Go version: go version go1.13.4 windows/amd64

syyongx added a commit that referenced this issue Nov 30, 2021
Fixed issue #25 in Bin2hex()
@syyongx
Copy link
Owner

syyongx commented Nov 30, 2021

Your request has been merged.

@syyongx syyongx closed this as completed Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants