[ 
https://issues.apache.org/jira/browse/BEAM-8579?focusedWorklogId=340799&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-340799
 ]

ASF GitHub Bot logged work on BEAM-8579:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 08/Nov/19 23:01
            Start Date: 08/Nov/19 23:01
    Worklog Time Spent: 10m 
      Work Description: lukecwik commented on pull request #10046: [BEAM-8579] 
Strip UTF-8 BOM from TextSource output.
URL: https://github.com/apache/beam/pull/10046#discussion_r344398516
 
 

 ##########
 File path: 
sdks/java/core/src/test/java/org/apache/beam/sdk/io/TextSourceTest.java
 ##########
 @@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.io;
+
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import org.apache.beam.sdk.coders.StringUtf8Coder;
+import org.apache.beam.sdk.io.FileIO.ReadableFile;
+import org.apache.beam.sdk.io.fs.EmptyMatchTreatment;
+import org.apache.beam.sdk.options.ValueProvider;
+import org.apache.beam.sdk.testing.NeedsRunner;
+import org.apache.beam.sdk.testing.PAssert;
+import org.apache.beam.sdk.testing.TestPipeline;
+import org.apache.beam.sdk.transforms.Create;
+import org.apache.beam.sdk.transforms.DoFn;
+import org.apache.beam.sdk.transforms.PTransform;
+import org.apache.beam.sdk.transforms.ParDo;
+import org.apache.beam.sdk.values.PCollection;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/** Tests for TextSource class. */
+@RunWith(JUnit4.class)
+public class TextSourceTest {
 
 Review comment:
   Please add these tests to `TextIOReadTest.java` instead of creating a new 
file.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 340799)
    Time Spent: 40m  (was: 0.5h)

> Strip UTF-8 BOM bytes (if present) in TextSource.
> -------------------------------------------------
>
>                 Key: BEAM-8579
>                 URL: https://issues.apache.org/jira/browse/BEAM-8579
>             Project: Beam
>          Issue Type: Bug
>          Components: io-java-text
>    Affects Versions: 2.15.0
>            Reporter: Changming Ma
>            Assignee: Changming Ma
>            Priority: Minor
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> TextSource in the org.apache.beam.sdk.io package can handle UTF-8 encoded 
> files, and when the file contains byte order mark (BOM), it will preserve it 
> in the output. According to Unicode standard 
> ([http://www.unicode.org/versions/Unicode5.0.0/ch02.pdf|https://www.google.com/url?q=http://www.unicode.org/versions/Unicode5.0.0/ch02.pdf&sa=D&usg=AFQjCNF_PW0McUUnM1UrvZSIwgvAj1uUKw]):
>  "Use of a BOM is neither required nor recommended for UTF-8". UTF-8 with a 
> BOM will also be a potential problem for some Java implementations (e.g., 
> [https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4508058|https://www.google.com/url?q=https://bugs.java.com/bugdatabase/view_bug.do?bug_id%3D4508058&sa=D&usg=AFQjCNEdT7vUK99N5bxQc9fkCt-uIG2v7Q]).
>  As a general practice, it's suggested to use UTF-8 without BOM.
> Proposal: remove BOM bytes in the output from TextSource.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to