We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
config = fmt.Sprintf(`<?xml version="1.0" encoding="UTF-8"?> <flow-definition plugin="[email protected]"> <description></description> <keepDependencies>false</keepDependencies> <properties/> <definition class="org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition" plugin="[email protected]"> <script> 测试 </script> <sandbox>true</sandbox> </definition> <triggers/> <disabled>false</disabled> </flow-definition>`) job.UpdateConfig(ctx, config)
测试 >> Jenkins displays garbled code >> æµ�è¯
The text was updated successfully, but these errors were encountered:
已修复,添加charset=utf-8到Content-Type标头显式指定字符编码修复 func (r *Requester) PostXML(ctx context.Context, endpoint string, xml string, responseStruct interface{}, querystring map[string]string) (*http.Response, error) { payload := bytes.NewBuffer([]byte(xml)) ar := NewAPIRequest("POST", endpoint, payload) if err := r.SetCrumb(ctx, ar); err != nil { return nil, err } ar.SetHeader("Content-Type", "application/xml; charset=utf-8") ar.Suffix = "" return r.Do(ctx, ar, &responseStruct, querystring) }
func (r *Requester) PostXML(ctx context.Context, endpoint string, xml string, responseStruct interface{}, querystring map[string]string) (*http.Response, error) { payload := bytes.NewBuffer([]byte(xml)) ar := NewAPIRequest("POST", endpoint, payload) if err := r.SetCrumb(ctx, ar); err != nil { return nil, err } ar.SetHeader("Content-Type", "application/xml; charset=utf-8") ar.Suffix = "" return r.Do(ctx, ar, &responseStruct, querystring) }
Sorry, something went wrong.
如何解决的
request.go文件中修改PostXML函数添加默认charset=utf-8
完整代码 func (r *Requester) PostXML(ctx context.Context, endpoint string, xml string, responseStruct interface{}, querystring map[string]string) (*http.Response, error) { payload := bytes.NewBuffer([]byte(xml)) ar := NewAPIRequest("POST", endpoint, payload) if err := r.SetCrumb(ctx, ar); err != nil { return nil, err } ar.SetHeader("Content-Type", "application/xml; charset=utf-8") ar.Suffix = "" return r.Do(ctx, ar, &responseStruct, querystring) }
No branches or pull requests
测试 >> Jenkins displays garbled code >> æµ�è¯
The text was updated successfully, but these errors were encountered: