title: Golang+Echo: Is there a good way to convert CRLF to LF for context.Bind in case multipart/form-data
body: <p>I'm use <code>github.com/labstack/echo</code> framefork, and when I retrive data from FE in <code>multipart/form-data</code>, strings contains line breaks as CRLF, but it makes a problem with counting string length, because of CRLF counts as 2 symbols (using <code>utf8.RuneCountInString</code>) it makes problem for validation I'm use (<code>github.com/go-playground/validator</code>). My frontend is also counts symbols in a  and validate it, but on FE string have a LF line-breaks, it automatically converts to CRLF for <code>multipart/form-data</code> (by specification)</p>
  <p>The <code>github.com/labstack/echo</code> has a way to use [CustomBinder] (<a href="https://echo.labstack.com/guide/request/#custom-binder" rel="nofollow noreferrer">https://echo.labstack.com/guide/request/#custom-binder</a>) but I don't know how to use it for convert CRLF to LF, because there is a lot of handler and different structures of data.</p>
  <p>Handler example:</p>
  <pre class="lang-golang prettyprint-override"><code>func handler(ctx echo.Context) error {
      var data struct {
          SomeField string `validate:&quot;max=512&quot;`
          // a set of other fields
      }
  
      if err := ctx.Bind(&amp;data); err != nil {
          panic(err)
      }
  
      if err := ctx.Validate(data); err != nil {
          panic(err)
      }
  
      utf8.RuneCountInString(data.SomeField) // counts \r\n as 2 symbols
  }
  </code></pre>
  <p>CustomBinder example:</p>
  <pre class="lang-golang prettyprint-override"><code>type CustomBinder struct {}
  
  func (cb *CustomBinder) Bind(i interface{}, c echo.Context) (err error) {
      // You may use default binder
      db := new(echo.DefaultBinder)
      if err = db.Bind(i, c); err != echo.ErrUnsupportedMediaType {
          return
      }
  
      // How to convert `CRLF` in all strings in `i` which is interface to `LF`?
  
      return
  }
  </code></pre>