title: Tabs cannot be used for indentation when parsing YAML string
body: <p>I have a <code>byte[]</code> that represents a UTF-8-encoded YAML string and I want to deserialize it. Here's the generic method I'm using:</p>
  
  <pre><code>public static &lt;T&gt; T getInstanceFromBinary(final Class&lt;T&gt; clazz, final byte[] binary, final String encoding)
          throws IOException {
      final StringReader stringReader = new StringReader(new String(binary, encoding));
      final String yamlString = stringReader.toString();
      final boolean hasTab = yamlString.contains("\t");
      final YamlReader reader = new YamlReader(stringReader);
      final T clazzInstance = reader.read(clazz);
      reader.close();
      return clazzInstance;
  }
  </code></pre>
  
  <p>and I'm getting this exception:</p>
  
  <pre><code>Caused by: com.esotericsoftware.yamlbeans.tokenizer.Tokenizer$TokenizerException: Line 185, column 35: Tabs cannot be used for indentation.
      at com.esotericsoftware.yamlbeans.tokenizer.Tokenizer.fetchMoreTokens(Tokenizer.java:313)
      at com.esotericsoftware.yamlbeans.tokenizer.Tokenizer.peekNextToken(Tokenizer.java:120)
      at com.esotericsoftware.yamlbeans.tokenizer.Tokenizer.peekNextTokenType(Tokenizer.java:125)
      at com.esotericsoftware.yamlbeans.parser.Parser$20.produce(Parser.java:320)
      at com.esotericsoftware.yamlbeans.parser.Parser.getNextEvent(Parser.java:80)
      at com.esotericsoftware.yamlbeans.parser.Parser.peekNextEvent(Parser.java:91)
      at com.esotericsoftware.yamlbeans.YamlReader.readValueInternal(YamlReader.java:270)
      at com.esotericsoftware.yamlbeans.YamlReader.readValue(YamlReader.java:152)
      at com.esotericsoftware.yamlbeans.YamlReader.readValueInternal(YamlReader.java:295)
      ... 38 more
  </code></pre>
  
  <p>The problem is that the decoded string doesn't seem to contain a tab character. Here's a screenshot from the debug that confirms this:</p>
  
  <p><a href="https://i.stack.imgur.com/HIH2I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HIH2I.png" alt="Debug info"></a></p>
  
  <p>I've also checked YAMLBeans source code, and <a href="https://github.com/EsotericSoftware/yamlbeans/blob/master/src/com/esotericsoftware/yamlbeans/tokenizer/Tokenizer.java#L312" rel="nofollow noreferrer">found where</a> this exception is thrown, although this didn't yield any light about why this is happening or how to solve this issue.</p>
  
  <p>Thanks in advance for any insights.</p>